赞
踩
columns:(表格项)
- import { NText } from 'naive-ui';
- import { h } from 'vue';
- const statusOptions = {
- 1: { text: '种类1', type: '' },
- 2: { text: '种类2', type: '' },
- };
- export const columns = [
- { type: 'selection', key: 'selection' },//复选框列
- {
- title: '序号',
- width: 40,
- align: 'center',
- render: (text: any, record: any, index: any) => {
- return record + 1;
- },
- },
- {
- title: '标题',
- key: 'content',
- width: 100,
- align: 'center',
- },
- {
- title: '类型',
- key: 'type',
- width: 100,
- align: 'center',
- render(row) {
- return h(
- NText,
- {
- type: statusOptions[row.type].type,
- },
- { default: () => statusOptions[row.type].text }
- );
- },
- },
- ];
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
request请求
- const loadDataTable = async (res) => {
- tableData.value = await getList({ ...params.value, ...res });
- return tableData.value;
- };
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。