1.在根目录下添加vue.config.js 和 uni.less
2.编辑vue.config.js
let path = require('path');
let stylePath = path.resolve(__dirname, 'uni.less')
module.exports = {
css: {
loaderOptions: {
less: {
globalVars: {
"hack": `true; @import "${stylePath}"`
}
}
}
},
}
3.完成配置即可在页面中编写less , 语言选择less
<style scoped lang="less">
@import url("fenlei.less");
</style>