Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自定义列使用slotName属性时,出现重复 #58

Closed
leonpun opened this issue Mar 3, 2020 · 0 comments
Closed

自定义列使用slotName属性时,出现重复 #58

leonpun opened this issue Mar 3, 2020 · 0 comments

Comments

@leonpun
Copy link

leonpun commented Mar 3, 2020

我想自定义列,可能是我使用不对么?

new Vue({
  el: '#app',
  data: {
    formOptions: {
      inline: true,
      submitBtnText: 'Search',
      forms: [
        { prop: 'name', label: 'Name' },
        { prop: 'mobile', label: 'Mobile' },
        { prop: 'sex', label: 'Sex', itemType: 'select',
         options: [
           { value: '', label: 'All' },
           { value: 0, label: 'Male' },
           { value: 1, label: 'Female' }
         ]
        }
      ]
    },
    columns: [
      { prop: 'name', label: 'Name', width: 140, slotName: 'test' },
      { prop: 'mobile', label: 'Mobile', minWidth: 180 },
      { prop: 'sex', label: 'Sex', width: 100,
       render: row => {
         const { sex } = row
         return sex === 0 ? 'Male' : sex === 1 ? 'Female' : 'Unknow'
       }
      }
    ],
    tableData: [
      { name: 'Sam', mobile: '15299xxxx', sex: 0 },
      { name: 'Jean', mobile: '13452xxxx', sex: 1 },
      { name: 'Tony', mobile: '187233xxxx', sex: 0 }
    ]
  },
  template:`
    <el-search-table-pagination
      type="local"
      :data="tableData"
      :page-sizes="[5, 10]"
      :columns="columns"
      :form-options="formOptions">

      <el-table-column label="Operate" slot="test" width="200px">
        <template slot-scope="scope">
          <el-button
            size="mini">Edit</el-button>
          <el-button
            size="mini"
            type="danger">Delete</el-button>
        </template>
      </el-table-column>
    </el-search-table-pagination>
  `
})

image

@leonpun leonpun closed this as completed Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant