1. 程式人生 > >iview的Table如何新增按鈕以及操作

iview的Table如何新增按鈕以及操作

 <Table border ref="selection"
 :stripe="true" 
 :columns="columns"
 width="97%"
 height="400"
 :data="data1">
 </Table>
{
          title: '訊息狀態', // '推送頻率',
          key: 'status', // 'frequencyDes',
          align: 'center',
          render: (h, params) => {
            if (this.data1[params.index].status === '稽核未通過') {
              return h('div', [
                h('span', {
                  style: {
                    marginTop: '10px',
                    display: 'inline-block',
                  },
                }, '稽核未通過'),
                h('Button', {
                  props: {
                    type: 'primary',
                  },
                  style: {
                    width: '80%',
                    display: 'flex',
                    'justify-content': 'center',
                  },
                  on: {
                    click: () => {
                      alert('稽核未通過');
                    },
                  },
                }, '檢視原因'),
              ]);
            } else if (this.data1[params.index].status === '稽核通過') {
              return h('div', [
                h('span', {
                  style: {
                    marginTop: '10px',
                    display: 'inline-block',
                  },
                }, '稽核通過'),
              ]);
            } else if (this.data1[params.index].status === '上線中') {
              return h('div', [
                h('span', {
                  style: {
                    marginTop: '10px',
                    display: 'inline-block',
                  },
                }, '上線中'),
              ]);
            } else if (this.data1[params.index].status === '已下線') {
              return h('div', [
                h('span', {
                  style: {
                    marginTop: '10px',
                    display: 'inline-block',
                  },
                }, '已下線'),
              ]);
            }
            return h('div', [
              h('span', {
                style: {
                  marginTop: '10px',
                  display: 'inline-block',
                },
              }, '稽核中'),
            ]);
          },
        },