美文网首页
飞冰 iceworks

飞冰 iceworks

作者: younglaker | 来源:发表于2019-08-26 15:59 被阅读0次

https://ice.work/

简单而友好的前端研发体系,海量可复用物料,搭配 GUI 工具极速构建前端应用。提供多种垂直领域模板和区块,快速创建项目,支持风格切换,满足个性化需求。物料自由搭配,开发调试一体化,覆盖项目研发的全流程管理,开箱即用。丰富模板一键创建,提供多种垂直领域模板,基于 GUI 工具快速创建项目,支持风格切换,满足个性化需求

安装、启动

https://ice.work/docs/iceworks/quick-start

$ npm install iceworks -g

运行:

$ iceworks # open http://localhost:8000/
image.png

新建页面

image.png

选择模板,可以多个模板组合:


image.png

填写路由、显示名


image.png

会自动生成页面文件:


image.png

自动添加路由


image.png

自动添加到menu:


image.png
image.png

修改menu名字

先切换成中文


image.png

/Users/laker/code/athena-admin/src/locales/zh-CN/menu.js
添加中文显示(英文menu同理):

'app.menu.deliveryreview': '物流审核',
image.png

axios

https://alligator.io/react/axios-react/

npm install axios --save
import axios from 'axios';

componentDidMount() {
    axios
      .get(
        '...',
        {
          crossDomain: true, // 跨域还需要后台开启允许跨域
          params: {
            index: 1,
            length: 5
          }
        }
      )
      .then(res => {
        const orders = res.data;
        this.setState({ orders });
      });
  }

默认模板警告 getRowClassName

报错

index.js:2178 Warning: [ getRowClassName ] is deprecated at [ Table ], use [ getRowProps ] instead of it.
in Config(StickyTable) (created by Index)
in Index (created by Anonymous)
in Anonymous (created by Router.Consumer)
in Router.Consumer (created by Route)
in Route (created by component)
in component (created by Router.Consumer)
in Router.Consumer (created by Route)
in Route

出错位置,原因getRowClassName被弃用,改为getRowProps

<Table getRowClassName={getRowClassName}>

改为

<Table  getRowProps={getRowClassName} >

还报错,要求改为rowProps

Warning: [ getRowProps ] is deprecated at [ Table in 1.15.0 ], use [ rowProps ] instead of it.
in Config(StickyTable) (created by Index)
in Index (created by Anonymous)
in Anonymous (created by Router.Consumer)
in Router.Consumer (created by Route)

再改为rowProps

<Table  rowProps={getRowClassName} >

警告 Invalid prop rowSelection

index.js:2178 Warning: Failed prop type: Invalid prop rowSelection of type function supplied to Config(StickyTable), expected object.

出错位置:

<Table rowSelection={handleRowSelection}  >

警告里没有写推荐属性,我看了下handleRowSelection的作用,应该是处理选择事件,查了下文档,https://ice.work/component/table ,它的值要求是object,而这里用了function


    /**
     * 选中当前行的回调
     */
    const handleRowSelection = (selectedRowKeys, records) => {
      console.log('selectedRowKeys:', selectedRowKeys);
      console.log('records:', records);
    };
image.png

有个onRowClick,也可以用来处理点击事件:

<Table  onRowClick={handleRowSelection} >

table

<Table dataSource={数据源} hasBorder={false}>
            <Table.GroupHeader cell={表头显示的内容的方法} /> 
            <Table.Column
              title="订单"
              width={400}
              dataIndex="数据源.detail"
              cell={renderOrderInfo}
            />
            <Table.Column title="状态" dataIndex="数据源.关键字" width={120} />
            <Table.Column cell={testFun} title="数据源.关键字" width={100} />
          </Table>

数据源.关键字 只能是一个关键字,如果想在一个单元格显示多个数据,要进行拼接JSON。
例如这里把多个数据重新拼接到detail,才能在一个单元格显示多个数据

        for (let i in orders) {
          // console.dir(i + ' : ' + orders[key]);
          const detail = {
            consignee: orders[i].consignee,
            area: orders[i].area,
            address: orders[i].address,
            city: orders[i].city,
            mobile: orders[i].mobile,
            province: orders[i].province,
            order_sn: orders[i].order_sn,
            created_at: orders[i].created_at
          };
          orders[i].detail = detail;
        }

<Table.Column dataIndex="数据源.detail"   />
image.png



相关文章

  • React 淘系飞冰框架

    飞冰简单而友好的前端研发体系 使用 iceworks 创建&开发项目 飞冰(ICE)提供了 iceworks 这个...

  • 飞冰 iceworks

    https://ice.work/ 简单而友好的前端研发体系,海量可复用物料,搭配 GUI 工具极速构建前端应用。...

  • 天外飞冰

  • 用飞冰Ice创建代码素材库到底行不行?

    title: 用飞冰Ice创建代码素材库到底行不行?category: Webtag: [飞冰,ice]date:...

  • 飞冰快速入门

    背景说明 项目前端需要使用飞冰开发框架进行开发,这里针对个人学习情况做备忘 官网地址 https://ice.wo...

  • IceWorks Design Pro 鉴权机制

    关键字 MainRoutes -> AuthorizedRoute -> RenderAuthorized -> ...

  • 飞冰下组件间跳转及传值

    接触飞冰不久,对于页面间相互跳转及传值的问题做个梳理。 查看飞冰官网,可以看到两种方式。https://aliba...

  • 阿里飞冰使用体验

    本质 就是一个脚手架的再封装版,添加了一些可视化筛选模板,组件的操作。仍然是生成代码,然后二次开发。底层封装了一系...

  • 飞冰接口代理方案

    背景说明 使用飞冰框架进行开发过程中,发现接口请求存在跨域问题,官方提供了比较好的解决方案,这里记录如下: 解决方...

  • 长篇小说连载《树》09

    韩飞对金冰的恋情还在意念阶段,金冰就像个白雪公主住进了他的心房里,金冰却浑然不觉。韩飞是坐也思君,卧也思君...

网友评论

      本文标题:飞冰 iceworks

      本文链接:https://www.haomeiwen.com/subject/kytdectx.html