一.el-tabs
1.element自己已經封裝好了,當切換時v-model的值自動切換為el-tabs-pane的name對應的值.
如下:
<el-tabs v-model='activeName'>
<el-tabs-pane name='aaa'>
<mycomponet v-if="activeName=='aaa'"></mycomponet>
</el-tabs-pane>
<el-tabs-pane name='bbb'>
<yourcomponet v-if="activeName=='bbb'"></yourcomponet>
</el-tabs-pane>
</el-tabs>
2.上面我還加上了v-if,現在就神奇了,可以利用v-if來及時刷新mycomponet,yourcomponet 里的內容 (mycomponet ,yourcomponet 自己去實現)
(見/views/agent/summary.vue)
二。el-select 多選
單選時,直接給v-model='id' 在data中直接給id賦值即可;
多選時,注意此時的id對於的是字符串數值。一定要記得是數組