Node.js/nuxt/其他:修订间差异
来自康健生活
| 第27行: | 第27行: | ||
// or | // or | ||
})(this);</syntaxhighlight> | })(this);</syntaxhighlight> | ||
在这里我添加了一个中转文件,这样就不用每次修改 iconfont 都要修改 iconfont.js | |||
{{hc|plugins/icon.ts|<syntaxhighlight lang="javascript"> | |||
/** | |||
* @author kangkk | |||
* @description 引用 iconfont 里面的 js 文件,直接引用会报出 window 未定义 | |||
* @type {module:fs} | |||
*/ | |||
const fs=require("fs") | |||
const buffer= fs.readFileSync('./assets/fonts/icon/iconfont.js') | |||
module.exports = `${String(buffer)}`</syntaxhighlight>}} | |||