最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vue實(shí)現(xiàn)樹狀表格效果

 更新時(shí)間:2020年12月29日 16:09:46   作者:保護(hù)我方豆豆  
這篇文章主要為大家詳細(xì)介紹了vue實(shí)現(xiàn)樹狀表格效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了vue實(shí)現(xiàn)樹狀表格的具體代碼,供大家參考,具體內(nèi)容如下

1. 初始化配置

安裝模塊:

npm i vue-table-with-tree-grid -S

main.js 文件

import ZkTable from 'vue-table-with-tree-grid'
Vue.component(ZkTable.name, ZkTable);

2. 使用

<template lang="html">
 <div id="example">
 <zk-table
  ref="table"
  index-text="#"
  :data="data"
  :columns="columns"
  :stripe="props.stripe"
  :border="props.border"
  :show-header="props.showHeader"
  :show-summary="props.showSummary"
  :show-row-hover="props.showRowHover"
  :show-index="props.showIndex"
  :tree-type="props.treeType"
  :is-fold="props.isFold"
  :expand-type="props.expandType"
  :selection-type="props.selectionType">

  <template slot="likes" scope="scope">
  {{ scope.row.likes.join(',') }}
  </template>
 </zk-table>
 </div>
</template>

<script>

 export default {
 name: 'example',

 data() {
  return {
  props: {
   stripe: false, // 是否顯示間隔斑馬紋
   border: true, // 是否顯示縱向邊框
   showHeader: true, // 是否顯示表頭
   showSummary: false, // 是否顯示表尾合計(jì)行
   showRowHover: true, // 鼠標(biāo)懸停時(shí),是否高亮當(dāng)前行
   showIndex: true, // 是否顯示數(shù)據(jù)索引
   treeType: true, // 是否為樹形表格
   isFold: true, // 樹形表格中父級(jí)是否默認(rèn)折疊
   expandType: false, // 是否為展開行類型表格(為 True 時(shí),需要添加名稱為 '$expand' 的作用域插槽, 它可以獲取到 row, rowIndex)
   selectionType: false, // 是否為多選類型表格
  },
  data: [
   {
   name: 'Jack',
   sex: 'male',
   likes: ['football', 'basketball'],
   score: 10,
   children: [
    {
    name: 'Ashley',
    sex: 'female',
    likes: ['football', 'basketball'],
    score: 20,
    children: [
     {
     name: 'Ashley',
     sex: 'female',
     likes: ['football', 'basketball'],
     score: 20,
     },
     {
     name: 'Taki',
     sex: 'male',
     likes: ['football', 'basketball'],
     score: 10,
     children: [
      {
      name: 'Ashley',
      sex: 'female',
      likes: ['football', 'basketball'],
      score: 20,
      },
      {
      name: 'Taki',
      sex: 'male',
      likes: ['football', 'basketball'],
      score: 10,
      children: [
       {
       name: 'Ashley',
       sex: 'female',
       likes: ['football', 'basketball'],
       score: 20,
       },
       {
       name: 'Taki',
       sex: 'male',
       likes: ['football', 'basketball'],
       score: 10,
       },
      ],
      },
     ],
     },
    ],
    },
    {
    name: 'Taki',
    sex: 'male',
    likes: ['football', 'basketball'],
    score: 10,
    },
   ],
   },
   {
   name: 'Tom',
   sex: 'male',
   likes: ['football', 'basketball'],
   score: 20,
   children: [
    {
    name: 'Ashley',
    sex: 'female',
    likes: ['football', 'basketball'],
    score: 20,
    children: [
     {
     name: 'Ashley',
     sex: 'female',
     likes: ['football', 'basketball'],
     score: 20,
     },
     {
     name: 'Taki',
     sex: 'male',
     likes: ['football', 'basketball'],
     score: 10,
     },
    ],
    },
    {
    name: 'Taki',
    sex: 'male',
    likes: ['football', 'basketball'],
    score: 10,
    children: [
     {
     name: 'Ashley',
     sex: 'female',
     likes: ['football', 'basketball'],
     score: 20,
     },
     {
     name: 'Taki',
     sex: 'male',
     likes: ['football', 'basketball'],
     score: 10,
     },
    ],
    },
   ],
   },
   {
   name: 'Tom',
   sex: 'male',
   likes: ['football', 'basketball'],
   score: 20,
   },
   {
   name: 'Tom',
   sex: 'male',
   likes: ['football', 'basketball'],
   score: 20,
   children: [
    {
    name: 'Ashley',
    sex: 'female',
    likes: ['football', 'basketball'],
    score: 20,
    },
    {
    name: 'Taki',
    sex: 'male',
    likes: ['football', 'basketball'],
    score: 10,
    },
   ],
   },
  ],
  columns: [
   {
   label: 'name', // 列標(biāo)題名稱
   prop: 'name', // 對應(yīng)列內(nèi)容的屬性名
   width: '400px', // 列寬度
   },
   {
   label: 'sex',
   prop: 'sex',
   minWidth: '50px',
   },
   {
   label: 'score',
   prop: 'score',
   },
   {
   label: 'likes',
   prop: 'likes',
   minWidth: '200px',
   type: 'template',
   template: 'likes', // 列類型為 'template'(自定義列模板) 時(shí),對應(yīng)的作用域插槽(它可以獲取到 row, rowIndex, column, columnIndex)名稱
   },
  ],
  };
 },
 };
</script>

<style scoped lang="less">
 * {
 margin: 0;
 padding: 0;
 }
 .switch-list {
 margin: 20px 0;
 list-style: none;
 overflow: hidden;
 }
 .switch-item {
 margin: 20px;
 float: left;
 }
</style>

3. 效果

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

相關(guān)文章

  • Vue模擬實(shí)現(xiàn)購物車結(jié)算功能

    Vue模擬實(shí)現(xiàn)購物車結(jié)算功能

    這篇文章主要為大家詳細(xì)介紹了Vue模擬實(shí)現(xiàn)購物車結(jié)算功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-09-09
  • vue循環(huán)數(shù)據(jù)v-for / v-if最后一條問題

    vue循環(huán)數(shù)據(jù)v-for / v-if最后一條問題

    這篇文章主要介紹了vue循環(huán)數(shù)據(jù)v-for / v-if最后一條問題,具有很好的參考價(jià)值,希望對大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-03-03
  • vue實(shí)現(xiàn)簡單的跑馬燈效果

    vue實(shí)現(xiàn)簡單的跑馬燈效果

    這篇文章主要為大家詳細(xì)介紹了vue實(shí)現(xiàn)簡單的跑馬燈效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-10-10
  • Vue 3 中使用 OpenLayers 實(shí)時(shí)顯示 zoom 及四角坐標(biāo)的實(shí)現(xiàn)代碼

    Vue 3 中使用 OpenLayers 實(shí)時(shí)顯示 zoom 

    本文介紹了如何在 Vue 3 中使用 OpenLayers 來獲取地圖的 zoom 值以及四角坐標(biāo)信息,并實(shí)時(shí)更新數(shù)據(jù),這種方式可以用于 GIS 應(yīng)用開發(fā),幫助用戶更好地了解當(dāng)前地圖范圍,感興趣的朋友一起看看吧
    2025-04-04
  • 詳解實(shí)現(xiàn)vue的數(shù)據(jù)響應(yīng)式原理

    詳解實(shí)現(xiàn)vue的數(shù)據(jù)響應(yīng)式原理

    這篇文章主要介紹了詳解實(shí)現(xiàn)vue的數(shù)據(jù)響應(yīng)式原理,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-01-01
  • 在vue中使用inheritAttrs實(shí)現(xiàn)組件的擴(kuò)展性介紹

    在vue中使用inheritAttrs實(shí)現(xiàn)組件的擴(kuò)展性介紹

    這篇文章主要介紹了在vue中使用inheritAttrs實(shí)現(xiàn)組件的擴(kuò)展性介紹,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-12-12
  • 基于Vue框架vux組件庫實(shí)現(xiàn)上拉刷新功能

    基于Vue框架vux組件庫實(shí)現(xiàn)上拉刷新功能

    這篇文章主要為大家詳細(xì)介紹了基于Vue框架vux組件庫實(shí)現(xiàn)上拉刷新功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-11-11
  • 在Vue3中處理異步API調(diào)用并更新表單數(shù)據(jù)的方法示例

    在Vue3中處理異步API調(diào)用并更新表單數(shù)據(jù)的方法示例

    這篇文章主要介紹了如何在Vue3中處理異步API調(diào)用并更新表單數(shù)據(jù)(附Demo),文中通過代碼示例講解的非常詳細(xì),對大家的學(xué)習(xí)或工作有一定的幫助,需要的朋友可以參考下
    2024-06-06
  • vue項(xiàng)目中路由跳轉(zhuǎn)頁面不變問題及解決

    vue項(xiàng)目中路由跳轉(zhuǎn)頁面不變問題及解決

    這篇文章主要介紹了vue項(xiàng)目中路由跳轉(zhuǎn)頁面不變問題及解決方案,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-08-08
  • Vue.js處理API請求失敗的最佳實(shí)踐和策略

    Vue.js處理API請求失敗的最佳實(shí)踐和策略

    在現(xiàn)代Web開發(fā)中,與后端API的交互是不可避免的,然而,網(wǎng)絡(luò)請求是不穩(wěn)定的,可能會(huì)因?yàn)楦鞣N原因失敗,因此,優(yōu)雅地處理API請求失敗的情況是提升用戶體驗(yàn)和應(yīng)用穩(wěn)定性的關(guān)鍵,本文將詳細(xì)介紹在Vue.js中處理API請求失敗的最佳實(shí)踐和策略,需要的朋友可以參考下
    2024-12-12

最新評論

营山县| 遂宁市| 玛沁县| 湖南省| 昆山市| 临江市| 浮梁县| 新乡市| 余干县| 泸西县| 岢岚县| 尉犁县| 通渭县| 西吉县| 天全县| 嘉鱼县| 东乡县| 池州市| 即墨市| 双辽市| 镇远县| 青神县| 普兰店市| 临夏市| 潢川县| 阜宁县| 库尔勒市| 陕西省| 桐柏县| 疏勒县| 福清市| 绵竹市| 潜江市| 三江| 七台河市| 湾仔区| 齐河县| 嵩明县| 清丰县| 乌兰察布市| 电白县|