详细代码:
github上查看方式
在公司做vue 动态设置element中table表单列的展示方式,点击复选框选中时,表单对应的显示,补选中时,隐藏,因为在网上找相关案例,没有一个比较合适的解决方法,所以自己按照自己的方法去实现此相关功能,希望对大家有帮助。
页面table表单对应的展示与隐藏
首次默认把需要展示的数据保存到浏览器的localstroang中
页面加载localstroang保存的数据
//请求刘篮球的localstrong中的数据
localdata : function(){
//this.firstlocaldata(); //设置首次展示的数据
if(localStorage.length>0){
//判断品牌机会显示或隐藏
if(localStorage.show_brand == 'true'){this.show_brand = true;this.showbrand = true;}else{this.show_brand = false;this.showbrand = false;}
//判断保证金显示或隐藏
if(localStorage.show_deposit == 'true'){this.show_deposit = true;this.showdeposit = true;}else{this.show_deposit = false;this.showdeposit = false;}
//判断合作平台显示或隐藏
if(localStorage.show_cooperation == 'true'){this.show_cooperation = true;this.showcooperation = true;}else{this.show_cooperation = false;this.showcooperation = false;}
//判断联系人显示或隐藏
if(localStorage.show_name == 'true'){this.show_name = true;this.showname = true;}else{this.showname = false;this.show_name = false;}
//判断合作品牌显示或隐藏
if(localStorage.show_brand == 'true'){this.show_brand = true;this.showbrand = true;}else{this.showbrand = false;this.show_brand = false;}
//判断联系电话显示或隐藏
if(localStorage.show_tel == 'true'){this.show_tel = true;this.showtel = true;}else{this.showtel = false;this.show_tel = false;}
//判断客户级别显示或隐藏
if(localStorage.show_level == 'true'){this.show_level = true;this.showlevel = true;}else{this.showlevel = false;this.show_level = false;}
//判断客户级别显示或隐藏
if(localStorage.show_status == 'true'){this.show_status = true;this.showstatus = true;}else{this.showstatus = false;this.show_status = false;}
//判断主要程度显示或隐藏
if(localStorage.show_importance == 'true'){this.show_importance = true;this.showimportance = true;}else{this.showimportance = false;this.show_importance = false;}
//判断省显示或隐藏
if(localStorage.show_province == 'true'){this.show_province = true;this.showprovince = true;}else{this.showprovince = false;this.show_province = false;}
//判断县显示或隐藏
if(localStorage.show_district == 'true'){this.show_district = true;this.showdistrict = true;}else{this.showdistrict = false;this.show_