element plus或者element UI的一些疑難雜癥

1、el-tree單選需要判斷是否可點,并展示禁用樣式,element plus中要想直接使用禁用樣式需要搭配復選框進行顯示的,但是我們業(yè)務需求是單選,

const defaultProps = {
    children: 'children',
    label: 'name',
    disabled: 'disabled',
    class:customNodeClass,
}

const customNodeClass = data => {
  if (data.disabled) {
    return 'is-penultimate'
  }
  return null
}

:deep(.is-penultimate > .el-tree-node__content) {
  color: #ccc;
  cursor: not-allowed !important;
}

圖示:


image.png

2.form表單不校驗的問題

const changePwdForm = reactive({
    oldPassword: null,
    pass: null,
    checkPass: null,
})  //初始化數據如果填寫為null的話form表單不校驗
//正確應該如下
const changePwdForm = reactive({
    oldPassword: '',
    pass: '',
    checkPass: '',
}) 

3.table復選框回顯不生效問題
加載數據之前先this.$refs.multipleTable.clearSelection();
之后匹配要會顯得數據

toggleSelection(rows) {
            if (rows) {
                rows.forEach(row => {
                    this.$refs.multipleTable.toggleRowSelection(this.table.tableData.find(item => { return row.id == item.id; }),true);
                });
            } else {
             this.$refs.multipleTable.clearSelection();
            }
},

4.el-popver 彈出框收線問題解決 增加popper-options


image.png
<el-popover placement="right" :width="900" trigger="click" :popper-options="{ modifiers: [{ enabled: true }], strategy: 'fixed', placement: 'auto' }">
        <template #reference>
            <el-button style="margin-right: 16px">Click to activate</el-button>
        </template>
        <ul>
            <li v-for="i in 10" :key="i">{{ i }}</li>
        </ul>
    </el-popover>

5.# [el-table,type='expand'展開行,@expand-change=" "事件動態(tài)數據刷新問題]

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容