Ant Design 入门-参照官方文档使用组件

先来一个按钮组件使用的对比,官方文档的(不能直接用)和实际能用的。

官网demo:

<pre class="has">
import { Table,Divider,Tag } from 'antd';

const columns = [{
title: 'Name',dataIndex: 'name',key: 'name',render: text => <a href="javascript:;">{text},},{
title: 'Age',dataIndex: 'age',key: 'age',{
title: 'Address',dataIndex: 'address',key: 'address',{
title: 'Tags',key: 'tags',dataIndex: 'tags',render: tags => (

{tags.map(tag => {tag})}

),{
title: 'Action',key: 'action',render: (text,record) => (

<a href="javascript:;">Invite {record.name}

),}];

const data = [{
key: '1',name: 'John Brown',age: 32,address: 'New York No. 1 Lake Park',tags: ['nice','developer'],{
key: '2',name: 'Jim Green',age: 42,address: 'London No. 1 Lake Park',tags: ['loser'],{
key: '3',name: 'Joe Black',address: 'Sidney No. 1 Lake Park',tags: ['cool','teacher'],}];

ReactDOM.render(

,mountNode);

自己写的:

<pre class="has">
import { Table,Tag } from 'antd';
import React,{ Component } from 'react';
export default class MiniappList extends Component {
render() {
const columns = [{
title: 'Name',{
title: 'Tags',render: tags => (

{tags.map(tag => {tag})}

),{
title: 'Action',record) => (

<a href="javascript:;">Invite {record.name}

),}];
const data = [{
  key: '1',{
  key: '2',}];
return(<Table columns={columns} dataSource={data} />);

}
}

自己写的和文档的区别:

1. 需要引用react并且继承Component

2.导出类

3.使用 Component 的 render 函数把标签放到 return 里面    -----完成

相关文章

过滤器:就是筛选filters: [ { text: '全部', v...
好处: 就是可以实现 响应式 拉伸行(row) 列(col)col要直接在...
创好vue 项目npm 下载antnpm i --save ant-design-vue@next完...
外面套个from 标签就好了。
antDesign表单函数配置分析用getFieldDecorator包起来的高阶...
之前在vue页面中引入axios使用,本篇在mainjs中引入1、mainj...