vue2如何引入less
大佬们vue2如何引入less啊看了网上很多安法都不成功。
官网的也用过,翻译问题有些看不懂,其他网上的又不生效。
试了大佬提供的链接在第四步出错
https://blog.csdn.net/skyblue...
报错代码如下
ERROR Failed to compile with 1 error 16:31:58
error in ./src/views/AboutView.vue?vue&type=style&index=0&id=4cebd208&lang=less&scoped=true&
Syntax Error:
}
.ant-carousel >>> .slick-slide {
^
Unrecognised input
Error in D:\Official Website\enroll\src\views\AboutView.vue (line 48, column 15)
ERROR in ./src/views/AboutView.vue?vue&type=style&index=0&id=4cebd208&lang=less&scoped=true& (./node_modules/css-loader/dist/cjs.js??clonedRuleSet-32[0].rules[0].use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-32[0].rules[0].use[2]!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-32[0].rules[0].use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/AboutView.vue?vue&type=style&index=0&id=4cebd208&lang=less&scoped=true&)
Module build failed (from ./node_modules/less-loader/dist/cjs.js):
}
.ant-carousel >>> .slick-slide {
^
Unrecognised input
Error in D:\Official Website\enroll\src\views\AboutView.vue (line 48, column 15)
@ ./node_modules/vue-style-loader/index.js??clonedRuleSet-32[0].rules[0].use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-32[0].rules[0].use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-32[0].rules[0].use[2]!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-32[0].rules[0].use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/AboutView.vue?vue&type=style&index=0&id=4cebd208&lang=less&scoped=true& 4:14-484 15:3-20:5 16:22-492
@ ./src/views/AboutView.vue?vue&type=style&index=0&id=4cebd208&lang=less&scoped=true& 1:0-557 1:0-557
@ ./src/views/AboutView.vue 4:0-94
@ ./src/router/index.js 19:11-21:29
@ ./src/main.js 8:0-30 20:10-16
webpack compiled with 1 error
感谢大佬的帮助
回答:
使用 /deep/ 代替>>>
如果你用的是vue-cli生成的项目,直接npm install less less-loader --save-dev就可以使用了
回答:
你的 >>> 是错的 修改成一个>
以上是 vue2如何引入less 的全部内容, 来源链接: utcz.com/p/937588.html