element的el-tabs控制,以及el-select 多選默認值


一.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對於的是字符串數值。一定要記得是數組


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM