npm install @sc/vue-cli-plugin-loading --save-dev
安装插件后,构建过程会自动替换html
// vue.config.js
module.exports = {
pluginOptions: {
// 骨架屏读取的key
loadingOptions: {
// 忽略的文件,不插入骨架屏
ignoreHtmlFiles: ['help', 'aboutUs'],
// 自定义html
html: '<div>...</div>',
// 自定义脚本
js: '<script type="text/javascript">...</script>',
// 自定义样式
style: `<style>...</style>`
}
}
}