js require 动态加载 变量目录的js数据。

2022-09-23 16:02:03 浏览数 (1)

代码语言:javascript复制
                    var temp = that.wordRow[this.wordRowIdx] ;
                    //import(mdPath).then((m)=>{
                    /*
                    import("@/data/exec/a.js").then((m)=>{
                        console.log(m.default)
                        that.execInfo = m.default;
                        that.curTopic = that.execInfo.topics[that.curStep];
                    })
                    */
                   that.execInfo = require(`@/data/exec/${temp}.js`).default;
                   console.log( JSON.stringify(that.execInfo) )
                   that.curTopic = that.execInfo.topics[that.curStep];

0 人点赞