1. 程式人生 > >lodash做多選元件

lodash做多選元件

新建立: multiplyChooser.vue

    <li v-for="(item, index) in selections" @click=“toggleSelection(index)” :title=“item.label” :class="{active: checkActive(index)}" (數組裡面如何驗證index) >{{ item.label }}

父元件: import VMulChooser from ‘…/…/components/base/multiplyChooser’ export default { components: { VCounter, VMulChooser },

data () { return { versionList: [ { label: ‘紙質報告’, value: 0 }, { label: ‘pdf’, value: 1 }, { label: ‘頁面報告’, value: 2 }, { label: ‘郵件’, value: 3 } ] } }