欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

使用 Element UI Table 的 slot-scope方法

 更新時間:2019年10月10日 11:01:24   作者:deniro_li  
這篇文章主要介紹了使用 Element UI Table 的 slot-scope方法,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

在 Element UI Table 的官網(wǎng)上,有一個“篩選”功能,里面可以利用 slot-scope,給表格記錄打標(biāo)簽。

關(guān)鍵代碼為:

<template slot-scope="scope">
 <el-tag
  :type="scope.row.tag === '家' ? 'primary' : 'success'"
  disable-transitions>{{scope.row.tag}}</el-tag>
</template>
  1. 這里首先利用 slot-scope 屬性(Vue 2.6.0 已廢棄)將子組件的數(shù)據(jù)(row.tag)傳遞給了父組件。
  2. 利用三元表達式為 <el-tag> 標(biāo)簽設(shè)定樣式。

實踐過程中,發(fā)現(xiàn)這個三元表達式?jīng)]法應(yīng)用。因為實際業(yè)務(wù)場景,記錄類型肯定不止兩個??!

這時,就該條件渲染指令出場了:

<el-tag v-if="scope.row.state === '已完成'" :type="'success'"
 disable-transitions>{{scope.row.state}}
</el-tag>
<el-tag v-else-if="scope.row.state === '未開始'" :type="'danger'"
 disable-transitions>{{scope.row.state}}
</el-tag>
<el-tag v-else-if="scope.row.state === '進行中'" :type="'warning'"
 disable-transitions>{{scope.row.state}}
</el-tag>

運行結(jié)果:

官網(wǎng)只是基本用法,真正實踐還是要靠積累與總結(jié)哦O(∩_∩)O哈哈~

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論