如何在VUE单页面中使用CLodop/Lodop(How to use clodop / loop in Vue single page)

首先,在LodopFuncs.js(Lodop官方提供的,没有的请自行去官网下载)的最后一行添加

export {getLodop}

然后,在要使用该插件的vue页面中import一下,然后在created hook中 加入计时器,不断尝试去查看window.CLODOP是否加载完毕,然后调用getLodop()即可,实例代码如下

 1 import {getLodop} from "../public/LodopFuncs";
 2 let LODOP = {}
 3 export default {
 4   name: 'App',
 5   created() {
 6   },
 7   mounted() {
 8     let a = setInterval(()=>{
 9       if(window.CLODOP){
10         LODOP = getLodop()
11         clearInterval(a)
12       }
13     },500)
14   }
15 }

另外,如果有ESLint报错误的话,在错误的行上面写这个代码即可

// eslint-disable-next-line no-undef
————————

First, add in the last line of lodopfuncs.js (officially provided by lodop, if not, please go to the official website to download)

export {getLodop}

Then, import in the Vue page to use the plug-in, then add a timer in created hook, constantly try to see if window.CLODOP is loaded, and then call getLodop (). The example code is as follows

 1 import {getLodop} from "../public/LodopFuncs";
 2 let LODOP = {}
 3 export default {
 4   name: 'App',
 5   created() {
 6   },
 7   mounted() {
 8     let a = setInterval(()=>{
 9       if(window.CLODOP){
10         LODOP = getLodop()
11         clearInterval(a)
12       }
13     },500)
14   }
15 }

In addition, if eslint reports an error, write this code on the wrong line

// eslint-disable-next-line no-undef