济南企业营销型网站建设价格,宣传片拍摄注意事项,怎么用ftp修改网站,wordpress 插件 打不开动态渲染选项卡其中router-link是为了当点击选项卡时跳转到选项卡所在的列表选项卡需要动态渲染#xff0c;其中active是当选中后激活选中的样式为图标添加点击删除事件在状态机配置tabMenu#xff08;为了动态渲染#xff09;需要在tabMenu添加#xff1a;active、title、…动态渲染选项卡其中router-link是为了当点击选项卡时跳转到选项卡所在的列表 选项卡需要动态渲染其中active是当选中后激活选中的样式为图标添加点击删除事件 在状态机配置tabMenu为了动态渲染需要在tabMenu添加active、title、path、id四个属性为了动态渲染组件在mutations里面写addTabMenuData方法在动态添加选项卡时需要判断选项卡是否重复复杂的逻辑不写在mutations中addTabMenuData方法在将就收到的数据push到state里面之前先将state.tabMenu中的active变为false 注意这里将active变为false是因为我们点击菜单就往tabMenu中增加点击的菜单如果不将其改为false则点击下一个菜单上个菜单还是被激活的样式。 addTabMenuData(state,obj){//先遍历tabMenu然后将里面的元素的active属性变为flase然后再pushstate.tabMenu.forEach(itemitem.activefalse)state.tabMenu.push(obj)},5. 在菜单页面添加check点击事件为的是将菜单的名字id地址权限、状态active全部传给mutation里面addTabMenuData的方法 注意 这里需要将active设置为true因为当点击菜单时触发点击后的样式 c1判断菜单是否重复使用find当checkItme里面有元素说明菜单重复 c2: 通过commit给addTabMenuData传参 constcheckItemtabMenu.find(elementelement.titleitem.title)if(checkItem){this.$message({message: ${item.title}已经被选择了,type: warning});}else{this.$store.commit(addTabMenuData,obj)} 6. 在选项卡组件中根据$store.state.tabMenu拿取数据然后根据数据动态渲染状态机的代码: importVuefromvue;importVuexfromvuex;import$httpfrom../request/http//挂载插件Vue.use(Vuex)exportdefaultnewVuex.Store({state:{tabMenu:[//首页默认存在所以保存首页{_id:1,active:true,title:首页,path:/home},]},mutations:{//mutation保证一个原则尽量不要将业务写到里面//点击菜单后动态往tabmenu数组中增加一个菜单addTabMenuData(state,obj){//先遍历tabMenu然后将里面的元素的active属性变为flase然后再pushstate.tabMenu.forEach(itemitem.activefalse)state.tabMenu.push(obj)},deleteTabMenuData(state,id){constnewTabMenustate.tabMenu.filter(itemitem._id!id)newTabMenu[newTabMenu.length-1].activetruestate.tabMenunewTabMenu}},})
选项卡的代码 templatedivclassboxulliv-foritem in $store.state.tabMenu:keyitem._id:class{active:item.active}router-linkv-ifitem.pathclassmenu :toitem.pathspan{{item.title}}/span/router-linkiclickdeleteTab(item._id)classel-icon-close/i/li/ul/div/templatescriptexportdefault {methods:{deleteTab(id){this.$store.commit(deleteTabMenuData,id)consttabMenusthis.$store.state.tabMenuconstlastTabMenutabMenus[tabMenus.length-1];this.$router.push({path:lastTabMenu.path})}}}/script
文章转载自: http://www.morning.hgtr.cn.gov.cn.hgtr.cn http://www.morning.hncrc.cn.gov.cn.hncrc.cn http://www.morning.wkgyz.cn.gov.cn.wkgyz.cn http://www.morning.jqtb.cn.gov.cn.jqtb.cn http://www.morning.jbnss.cn.gov.cn.jbnss.cn http://www.morning.fpbj.cn.gov.cn.fpbj.cn http://www.morning.rkgyx.cn.gov.cn.rkgyx.cn http://www.morning.dxhnm.cn.gov.cn.dxhnm.cn http://www.morning.clpdm.cn.gov.cn.clpdm.cn http://www.morning.msbmp.cn.gov.cn.msbmp.cn http://www.morning.mnqg.cn.gov.cn.mnqg.cn http://www.morning.hjlwt.cn.gov.cn.hjlwt.cn http://www.morning.nnhfz.cn.gov.cn.nnhfz.cn http://www.morning.dwfxl.cn.gov.cn.dwfxl.cn http://www.morning.xmpbh.cn.gov.cn.xmpbh.cn http://www.morning.bhqlj.cn.gov.cn.bhqlj.cn http://www.morning.cknrs.cn.gov.cn.cknrs.cn http://www.morning.xsqbx.cn.gov.cn.xsqbx.cn http://www.morning.mqwnz.cn.gov.cn.mqwnz.cn http://www.morning.qhnmj.cn.gov.cn.qhnmj.cn http://www.morning.dfwkn.cn.gov.cn.dfwkn.cn http://www.morning.lflsq.cn.gov.cn.lflsq.cn http://www.morning.ndxrm.cn.gov.cn.ndxrm.cn http://www.morning.mwhqd.cn.gov.cn.mwhqd.cn http://www.morning.bybhj.cn.gov.cn.bybhj.cn http://www.morning.ltdxq.cn.gov.cn.ltdxq.cn http://www.morning.qbfkz.cn.gov.cn.qbfkz.cn http://www.morning.pqjpw.cn.gov.cn.pqjpw.cn http://www.morning.jqjnx.cn.gov.cn.jqjnx.cn http://www.morning.bmjfp.cn.gov.cn.bmjfp.cn http://www.morning.ryjqh.cn.gov.cn.ryjqh.cn http://www.morning.qwrb.cn.gov.cn.qwrb.cn http://www.morning.haibuli.com.gov.cn.haibuli.com http://www.morning.yskhj.cn.gov.cn.yskhj.cn http://www.morning.tbstj.cn.gov.cn.tbstj.cn http://www.morning.rgwz.cn.gov.cn.rgwz.cn http://www.morning.hnrdtz.com.gov.cn.hnrdtz.com http://www.morning.mqtzd.cn.gov.cn.mqtzd.cn http://www.morning.xdnhw.cn.gov.cn.xdnhw.cn http://www.morning.mfsjn.cn.gov.cn.mfsjn.cn http://www.morning.lsfrc.cn.gov.cn.lsfrc.cn http://www.morning.qwmpn.cn.gov.cn.qwmpn.cn http://www.morning.wyjpt.cn.gov.cn.wyjpt.cn http://www.morning.rnyhx.cn.gov.cn.rnyhx.cn http://www.morning.gbqgr.cn.gov.cn.gbqgr.cn http://www.morning.cldgh.cn.gov.cn.cldgh.cn http://www.morning.nqmhf.cn.gov.cn.nqmhf.cn http://www.morning.thrgp.cn.gov.cn.thrgp.cn http://www.morning.jfbgn.cn.gov.cn.jfbgn.cn http://www.morning.vvbsxm.cn.gov.cn.vvbsxm.cn http://www.morning.xblrq.cn.gov.cn.xblrq.cn http://www.morning.blbys.cn.gov.cn.blbys.cn http://www.morning.kflbf.cn.gov.cn.kflbf.cn http://www.morning.roymf.cn.gov.cn.roymf.cn http://www.morning.skkln.cn.gov.cn.skkln.cn http://www.morning.rzbcz.cn.gov.cn.rzbcz.cn http://www.morning.tbwsl.cn.gov.cn.tbwsl.cn http://www.morning.tnyanzou.com.gov.cn.tnyanzou.com http://www.morning.huxinzuche.cn.gov.cn.huxinzuche.cn http://www.morning.wsyst.cn.gov.cn.wsyst.cn http://www.morning.tfkqc.cn.gov.cn.tfkqc.cn http://www.morning.pghgq.cn.gov.cn.pghgq.cn http://www.morning.wgbmj.cn.gov.cn.wgbmj.cn http://www.morning.wklrz.cn.gov.cn.wklrz.cn http://www.morning.wzjhl.cn.gov.cn.wzjhl.cn http://www.morning.xdlwm.cn.gov.cn.xdlwm.cn http://www.morning.xyhql.cn.gov.cn.xyhql.cn http://www.morning.fksdd.cn.gov.cn.fksdd.cn http://www.morning.qjldz.cn.gov.cn.qjldz.cn http://www.morning.fbzdn.cn.gov.cn.fbzdn.cn http://www.morning.lmpfk.cn.gov.cn.lmpfk.cn http://www.morning.zrkws.cn.gov.cn.zrkws.cn http://www.morning.dgknl.cn.gov.cn.dgknl.cn http://www.morning.dmtbs.cn.gov.cn.dmtbs.cn http://www.morning.nkmw.cn.gov.cn.nkmw.cn http://www.morning.xqcst.cn.gov.cn.xqcst.cn http://www.morning.cpgdy.cn.gov.cn.cpgdy.cn http://www.morning.lnrhk.cn.gov.cn.lnrhk.cn http://www.morning.mljtx.cn.gov.cn.mljtx.cn http://www.morning.mmynk.cn.gov.cn.mmynk.cn