vue组件应该传递原始类型..生成器组件怎么样? (例如:表单生成器)

时间:2017-03-15 10:13:18

标签: vue.js vuejs2 vue-component

我已经阅读了很多关于vue组件的文档,提到了将基本类型值传递给组件。

当然我知道为什么它应该将原始值传递给组件,但生成器组件如表单生成器怎么样?它必须传递数组或对象才能生成..

<i-table
  :title="exampleTable.title"
  :class-name="exampleTable.className"
  :model="agents"
  :schema="exampleTable.schema"
  :buttons="exampleTable.buttons">
</i-table>
exampleTable: {
  title: '',
  className: 'table-striped',
  schema: [{
    name: 'email',
    displayName: 'user.email',
    tag: ''
  }, {
    name: 'name',
    displayName: 'user.name',
    tag: ''
  }, {
    name: 'createdAt',
    displayName: 'user.createdAt',
    tag: 'date'
  }, {
    name: '',
    tag: 'array',
    itemActions: [{
      name: 'button.edit',
      type: 'button',
      class: 'btn-outline-secondary btn-small',
      method: data => { this.showEditModal(data, 'edit') },
      disabled: false
    }, {
      name: 'sidebar.plan',
      type: 'button',
      class: 'btn-outline-secondary btn-small',
      method: data => { this.showPayModal(data, 'show') },
      disabled: false
    }]
  }],       
  buttons: [{
    text: 'button.add',
    class: 'btn-primary pull-right',
    method: data => { this.showPayModal(data, 'add') },
    disabled: false
  }]

这是我的例子,如何在不传递原始类型值的情况下制作。?

有什么想做更好的vue2吗?

0 个答案:

没有答案