vue防抖简练应用

167 阅读1分钟

clearTimeout(this.isChange);
if(!this.isChange){  
let teststr = newValue.substring(newValue.indexOf('``` mindmap')+1);  
let teststr2 = teststr.substring(0,teststr.indexOf('```'));  
let data2 = transform(parse(teststr2));  
markmap('svg.svg-one', data2, {    
preset: 'colorful', // or default    
linkShape: 'diagonal' // or bracket  });
}
this.isChange = setTimeout(() => {
  this.isChange = null
},2000)