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

Vuex,iView UI面包屑導(dǎo)航使用擴(kuò)展詳解

 更新時(shí)間:2019年11月04日 14:35:36   作者:cdx1170776994  
今天小編就為大家分享一篇Vuex,iView UI面包屑導(dǎo)航使用擴(kuò)展詳解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧

本案例是基于Vuex的公共數(shù)據(jù)庫,你在了解本案例之前要了解Vuex的使用方法。

https://www.iviewui.com/components/breadcrumb

打開網(wǎng)址我們可以知道這個(gè)組件的面包屑導(dǎo)航是基于路由跳轉(zhuǎn)的。但是我們項(xiàng)目中常常用到單頁面查詢面包屑導(dǎo)航。小生開始為這個(gè)糾結(jié)好久。然后和小伙伴一起研究出來一套單頁面不用路由跳轉(zhuǎn)的使用方法。

先看看效果圖

1,首次進(jìn)來

2,查詢結(jié)果

3,再次點(diǎn)擊面包屑導(dǎo)航

4,查詢結(jié)果

基本的效果是這樣的

下面看代碼

<template>
 <div class="members">
     <Breadcrumb separator=">" >   //面面包屑導(dǎo)航組件,用“>”隔開
      <BreadcrumbItem  v-for="(item,index) in accountList"> // 用v-for遍歷循環(huán)賬號(hào)數(shù)組
        <span class="select_span" @click="queryAgentMember(item)"> //商品這里放置賬號(hào),調(diào)用查詢函數(shù)實(shí)現(xiàn)點(diǎn)擊賬號(hào)查詢
         <Icon v-if="index==0" type="ios-home-outline"></Icon> // v-if判斷第一個(gè)賬號(hào)的圖標(biāo)
         <Icon v-if="index>0" type="android-person"></Icon> // v-if判斷不是第一個(gè)賬號(hào)的圖標(biāo)
         <span>{{item}}</span> // 圖標(biāo)后面的賬號(hào)
        </span>
      </BreadcrumbItem>
     </Breadcrumb>
  <Table class="table_a" :border="showBorder" :stripe="showStripe" :show-header="showHeader" :height="fixedHeader ? 250 : ''"
      :size="tableSize" :data="queryAgentMemberdataList" :columns="tableColumns3"></Table>
 </div>
</template>
<script>
 import { mapActions,mapState } from "vuex";
 export default {
  data () {
   return {
    Account:'', //定義一個(gè)賬號(hào)變量
    accountList:[], //定義一個(gè)數(shù)組裝賬號(hào)
    queryAgentMemberdataList:[], //這是表格列表數(shù)據(jù)
 
   }
  },
  methods:{
   ...mapActions('account',
    [
     'queryAgentMemberInfo',
    ]
   ),
   //查詢函數(shù)
   search(acc) {
    this.time();
    if(acc ){ //對(duì)函數(shù)參數(shù)進(jìn)行判斷,在有賬號(hào)的情況下
      this.Account = acc; // 如果有就賦值給Account
    }else if(this.childAccount === ""){ //繼續(xù)判斷沒有下級(jí)賬號(hào)
     this.Account = this.userDetail.account; // 如果沒有就等于后臺(tái)返回的賬號(hào)
     if(this.accountList.indexOf(this.userDetail.account)==-1){ // 再一次判斷這個(gè)賬號(hào)在不在賬號(hào)數(shù)組里面,這里是不在的情況下
      this.accountList.push(this.userDetail.account) // 不在就push到賬號(hào)數(shù)組
     }
 
    }else { //對(duì)函數(shù)參數(shù)進(jìn)行判斷,在沒有賬號(hào)的情況下
     this.Account = this.childAccount
    }
    let data = {
     'memberAccount':this.Account,
     'sort': '1',
     'type': '1'
    };
    this.queryAgentMemberInfo(data).then((res) => {
     this.queryAgentMemberdataList = this.queryAgentMemberInfoList;
    })
   },
   // 面包屑導(dǎo)航點(diǎn)擊查詢實(shí)時(shí)變更函數(shù)
   queryAgentMember(account){
    let end = this.accountList.indexOf(account); // 定義一個(gè)變量等于傳入的賬號(hào)的下標(biāo)
    this.accountList = this.accountList.slice(0,end+1); // 利用這個(gè)下標(biāo)對(duì)張海數(shù)組進(jìn)行截取
    this.search(account) //調(diào)用查詢函數(shù)更新表格數(shù)據(jù)
   },
  },
  computed: {
   ...mapState(['userDetail']),
   ...mapState( "account",['queryAgentMemberInfoList',]),
   tableColumns3 () {
    let columns = [];
    if (this.showCheckbox) {
     columns.push({
      type: 'selection',
      align: 'center'
     })
    }
    if (this.showIndex) {
     columns.push({
      type: 'index',
      align: 'center'
     })
    }
    columns.push({
     title: '會(huì)員賬號(hào)',
     sortable: true,
     render: (h, params) => {
      if (params.row.account === this.Account) {
      }
      return h('Span',{
       props: {
        type: 'text'
       },
       style: {
        color: '#4ca5e9',
        cursor: 'pointer'
       },
       on: {  // 這里還要對(duì)表格賬號(hào)點(diǎn)擊查詢進(jìn)行判斷
        click:()=>{
         //同樣的先判斷賬號(hào)數(shù)組里面有沒有當(dāng)前查詢的賬號(hào),這里也是在沒有的額情況下
         if(this.accountList.indexOf(params.row.account)==-1){ 
          //沒有就將當(dāng)前查詢的賬號(hào)添加到賬號(hào)數(shù)組
          this.accountList.push(params.row.account)
         }
         this.search(params.row.account); //查詢函數(shù)
        }
       }
      },params.row.account)
     }
    });
    columns.push({
     title: '賬號(hào)名稱',
     key: 'name'
    });
    columns.push({
     title: '彩票錢包余額',
     key: 'accountBalance',
     sortable: true
    });
    columns.push({
     title: '團(tuán)隊(duì)人數(shù)',
     key: 'childCount'
    });
    columns.push({
     title: '注冊(cè)時(shí)間',
     key: 'create_Time',
     sortable: true,
     width: 200
    });
    columns.push({
     title: '最后登錄時(shí)間',
     key: 'last_LoginTime',
     sortable: true,
     width: 150
    });
    columns.push({
     title: '下級(jí)總額',
     key: 'childAmount'
    });
    return columns;
   },
  },
  watch:{
   userDetail(){
    this.search()
   }
  }
 }
</script>

這里的代碼不可以直接使用,但是方法都在,希望讀者可以看懂。

以上這篇Vuex,iView UI面包屑導(dǎo)航使用擴(kuò)展詳解就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論