需要在vite配置
plugins: [
css: {
preprocessorOptions: {
less: {
additionalData: '@import "./src/styles/variables.module.less"; @import "./src/views/Visualization/component/ViewportCom/px2viewport.less";',
javascriptEnabled: true
}
}
},
]
多个文件按上面格式引入
使用
<style lang="less" scoped>
.viewport {
.px2font(20);
background-color: red;
}
</style>