Based on VUE,Iview, wangeditor3 components are integrated in Tab tabs. When there are multiple tabs, wangeditor is created repeatedly and cannot be edited.

I"m doing a background tab to switch between different options, add different panels, and then add different vue components to the panel

the basic style is as follows, no problem at this time

clipboard.png

clipboard.png

"" ""

clipboard.png

wangeditorwrite_article.vuevuemounted

clipboard.png

write_article.vue


-sharp-sharp-sharp F5

" X " "" emmmmmmm.......

"" F5 "" F5

clipboard.png

the strange problem is that the first red box cannot be edited, but the second red box can edit emmmmmmm, and the log is also output many times. I think it is the problem of wangeditor creation. I don"t know if there is something wrong with the way I load the component, or if there is any incompatibility. I hope you can take a look at it. Below, I will post the specific code for loading the component

.

this is the Tabs click method, which is the direct click tab title mentioned above,

<Tabs class="style-tab" type="card" v-model="activeIndex" closable @on-tab-remove="removeTab" @on-click="TabClick">

//
    TabClick:function(){
      var path = "/404";
      for (var i = 0 ;i<this.submenuList.length;iPP){
        for (var j = 0;j<this.submenuList[i].childList.length;jPP){
          if (this.submenuList[i].childList[j].child_index === this.activeIndex){
            path = this.submenuList[i].childList[j].to_path;
          }
        }
      }
      console.log("TabClick "+this.intIPP);
      this.$router.push({name:path})
    },

this is what is triggered when the Tab tab is closed, which is triggered when you click"x" next to the title of that tab.

 //tab
    removeTab(childIndex) {
      var path = "ServiceController";
      this.openNames.remove(childIndex);
      /**  **/
      let tabs = this.editableTabs;
      this.editableTabs = tabs.filter(tab => tab.index !== childIndex);

      for (var i = 0 ;i<this.submenuList.length;iPP){
        for (var j = 0;j<this.submenuList[i].childList.length;jPP){
          if (this.submenuList[i].childList[j].child_index === this.activeIndex){
            path = this.submenuList[i].childList[j].to_path;
          }
        }
      }
      console.log("removeTab "+this.intIPP);
      this.$router.push({name:path})
    },
    

this is when I implement the F5 refresh to determine whether the operation of the open panel is recorded and load the contents of the tab being displayed

      //ajaxmounted 
  mounted:function () {
    var open = localStorage.getItem("open-names");
    var active = localStorage.getItem("active-name");
    if (null != open){
      // console.log(" openNames value:"+this.openNames);
      this.openNames = open.split(",");
      // console.log(" openNames value:"+this.openNames+" openNames :"+this.openNames.length);
      for (var i=0;i<this.openNames.length;iPP){
        // console.log(" : "+this.openNames[i]);
        for (var j=0;j<this.submenuList.length;jPP){
          for (var k=0;k<this.submenuList[j].childList.length;kPP){
            //openNames
            if (this.submenuList[j].childList[k].child_index === this.openNames[i]){
              // console.log(":"+this.submenuList[j].childList[k]);
              this.editableTabs.push({
                title: this.submenuList[j].childList[k].child_title,//
                index: this.submenuList[j].childList[k].child_index, //
                content: this.submenuList[j].childList[k].to_path,//
              });
              //
              if (this.submenuList[j].childList[k].child_index === active){
                console.log("mounted "+this.intIPP);
                this.$router.push({name:this.submenuList[j].childList[k].to_path});
                this.activeIndex = active;
              }
            }
          }
        }
      }
    }else {//ServiceController
      console.log("mounted "+this.intIPP);
      this.$router.push({name:"ServiceController"})
    }
  },
  

the specific implementation code is all here. I hope the boss can take a look at it. Seriously, it"s a little too much, but I still hope the boss can calm down and take a closer look. I"ve been watching it for a long time, but it"s too bad, so I encounter so many problems in my study.


ashamed, I solved this problem soon after it was released
I'll talk about my solution first

clipboard.png

clipboard.png

since then, the bug mentioned above has disappeared. Yes, it has just disappeared
eeeeeeeeemmmmmmmmmmmmmmmmmmm.

but I still don't quite understand the difference between binding id and using ref here. If any boss knows, please leave a message below

Finally, I have a question. The sentence in the log write_article: is mounted executing
or how many tabs will be opened? it will be output as many times as possible. This is the only question left.

Menu