npm install @vue/babel-preset-jsx @vue/babel-helper-vue-jsx-merge-props --save-dev
# or
cnpm install @vue/babel-preset-jsx @vue/babel-helper-vue-jsx-merge-props --save-dev
将 MoTable目录复制到项目中
import MoTable from 'path/MoTable';
<MoTable :data="" :col="" {...} />
Array
[注意]如果data 存在 则优先级高于下面 attrs 中的 data
<MoTable :data="tabelData" />
export default {
name: "App",
components: {
MoTable
},
data() {
return {
tableData: [
{
date: "2020-03-27",
name: "老村长",
address: "四川省成都市青羊区人民中路一段16号"
},
{
date: "2020-03-27",
name: "老村长",
address: "四川省成都市青羊区人民中路一段16号"
},
{
date: "2020-03-27",
name: "老村长",
address: "四川省成都市青羊区人民中路一段16号"
},
{
date: "2020-03-27",
name: "老村长1",
address: "四川省成都市青羊区人民中路一段16号"
}
]
};
}
};
Array
https://element.eleme.cn/#/zh-CN/component/table#table-column-attributes
[注意] Scoped Slot 通过 scopedSlots 属性指定
支持上述链接中的所有属性
<MoTable :cols="cols" />
export default {
name: "App",
components: {
MoTable
},
data() {
return {
cols: [
{ align: "center", type: "index" },
{ align: "center", type: "selection" },
{ prop: "date", label: "日期", width: "180" },
{ prop: "name", label: "姓名", width: "180" },
{ prop: "address", label: "地址" },
{
label: "操作",
align: "center",
width: "140",
scopedSlots: {
default: scoped => {
return (
<el-button
onClick={() =>
this.handlerEditor(scoped.row)
}
type="primary"
plain
size="small"
icon="el-icon-edit"
>
Editor
</el-button>
);
}
}
}
]
};
},
methods: {
handlerEditor(row) {
console.log(row)
}
}
};
Object
https://element.eleme.cn/#/zh-CN/component/table#table-attributes
支持上述链接中的所有属性
[注意] 如果上面data 存在 则优先级高于arrts中的data,会被上面data覆盖
<MoTable :attrs="tableAttrs" />
export default {
name: "App",
components: {
MoTable
},
data() {
return {
tableAttrs: {
stripe: true,
border: true,
"show-header": true,
data: [
{
date: "2020-03-27",
name: "老村长",
address: "四川省成都市青羊区人民中路一段16号"
},
{
date: "2020-03-27",
name: "老村长",
address: "四川省成都市青羊区人民中路一段16号"
},
{
date: "2020-03-27",
name: "老村长",
address: "四川省成都市青羊区人民中路一段16号"
},
{
date: "2020-03-27",
name: "老村长",
address: "四川省成都市青羊区人民中路一段16号"
}
]
}
};
}
};
Object
https://element.eleme.cn/#/zh-CN/component/table#table-events
支持上述链接中的所有属性
参数同上述链接中的参数相同
<MoTable :events="tableEvents" />
export default {
name: "App",
components: {
MoTable
},
data() {
return {
tableEvents: {
"row-click": (row, column, event) => {
console.log(row);
console.log(column);
console.log(event);
}
}
};
}
};
Object
https://element.eleme.cn/#/zh-CN/component/pagination#attributes
支持上面链接中的所有参数,带中划线参数转为驼峰命名page-count => pageCount
除了上面参数之外添加新的参数:[align] 对齐方式 'left', 'center', 'right'
<MoTable :paging="pagingAttrs" />
export default {
name: "App",
components: {
MoTable
},
data() {
return {
pagingAttrs: {
currentPage: 1,
pageSizes: [10, 20, 30, 40, 50],
pageSize: 0,
layout: "total, sizes, prev, pager, next, jumper",
total: 4
}
};
}
};
Object
ttps://element.eleme.cn/#/zh-CN/component/pagination#events
支持上面链接中的所有事件,带中划线事件名转为驼峰命名 current-change => currentChange
<MoTable :pagingEvents="pagingEvents" />
export default {
name: "App",
components: {
MoTable
},
data() {
return {
pagingEvents: {
sizeChange: () => {},
currentChange: () => {}
}
};
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型