vue Element学习和问题处理

时间:2023-03-08 23:44:56
vue Element学习和问题处理
1. resetForm内容没有完全被重置
在使用resetForm时,会还原数据到初始化data时的值,有时会出现值已修改,但页面无刷新变化。
添加:
this.$nextTick(() => {
this.resetForm(type);
});

将form的赋值写在后面。

如果还是不行,就将赋值写在

this.$nextTick(function(){****});
2. 编辑时,部分组件赋值有问题,例如autoComplate选择值后无法自动带入到内容框,需要点击其它按钮触发。  
this.form = res.data; //直接从远端获取内容,给this.form有时不行,form中有一些其它的内容,
Object.assign(this.form, res.data);  //可使用这种形式传递对象内容

3. 树展开和折叠

for(var i=0;i<this.$refs.treeX.store._getAllNodes().length;i++){
this.$refs.treeX.store._getAllNodes()[i].expanded=this.isexpand;
}

4. 校验未清除

 this.$refs.menuform.clearValidate();

5. 有时select元素选择后无法选中,或者其它一些赋值后,页面没有刷新,有可能值太深,导致没有触发upload,可强制使用刷新。

this.$forceUpdate();

6. 日期控件clearable不起作用

要使用   :clearable="false"  才可以