iview踩坑

1 關於樹形組件

   點擊目錄實現展開收縮

return h('span', {
            style: {
              display: 'inline-block',
              width: '90%',
            },
            class:"tree-list",
            on: {
              click: () => { 
                //控制樹的目錄結點 展開收縮
                // data.expand = !data.expand
                data.expand = !data.expand
              }
            }
          },

2 menu 導航不支持多級嵌套

 2.10.1 版已經實現

3 modal 對話框確定按鈕的loading 狀態 設爲假時  對話框會自己消失

 setTimeout(function () {
          _this.loading = false
          _this.$nextTick(() => {_this.loading = true;});
        }, 500)

設爲假時 需要這樣設置


4 不同子路由來回切換 對應的導航菜單不高亮,也不展開子項

pdateOpened手動更新展開的子目錄,注意要在 $nextTick 裏調用

$route(to, from) {
      this.changeVal = this.$route.name;
      sessionStorage.setItem("changeNav", this.changeVal);
      this.$nextTick(function() {
        this.$refs.menu.updateOpened();
        this.$refs.menu.updateActiveName();
      });
    }

5  實現分頁時,切換不同的每頁顯示多少條數據後 無效果(點擊後還顯示未點擊前的狀態)

 點擊切換後,表格顯示隱藏用了v-if,換成v-show 可解決


6 iview select 下拉列表 無法設置默認值

  通過設置v-model動態綁定,還需要注意 綁定的默認值要和option綁定的值 保持一致

<Select class="w330 account_list" 
  v-model="editModal.accountListVal" 
  @on-change="onOptionAccountChange">
     <Option v-for="item in editModal.accountList" :value="item.account_id" :key="item.account_id">
          {{ item.account_name }}
      </Option>
</Select>
7  did you register the component correctly? For recursive components, make sure to provide the "name" option.

出現這個問題 先檢查自己的組件引用有沒有問題,然後子組件註冊放到最前邊

export default{
	name:'changePass',
	components:{
	    BasePass,
	},
	data (){
	  return {}
}}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章