一、安装less和less-loader
代码语言:javascript复制npm install less less-loader --save
二、在build/webpack.base.conf.js文件添加
代码语言:javascript复制 {
test: /.less$/,
loader: 'style-loader!css-loader!less-loader'
},
三、在组件中引入 lang="less"
代码语言:javascript复制<style scoped lang="less">
@color: #088;
div {
width: 200px;
height: 200px;
background: @color;
display: flex;
span {
font-size: 30px;
color: #fff;
margin: auto;
}
}
</style>