简介

框架预置Less支持.Less 是一门 CSS 预处理语言,它扩展了 CSS 语言,增加了变量、Mixin、函数等特性.详细的Less内容可参考:Less官方文档.

启用Less

在框架工程中启动Less只需要设置vue文件中的style标签的lang属性为less即可.支持内联和外联

  1. <template>
  2. ...
  3. </template>
  4. <script>
  5. ...
  6. </script>
  7. <!-- 外联less -->
  8. <style lang="less" src="./default.less" scoped></style>
  9. <!-- 内联less -->
  10. <style lang="less" scoped>
  11. @text-color-default:#cccccc;
  12. .text-common{
  13. color:@text-color-default;
  14. }
  15. .text-content{
  16. .text-common();
  17. }
  18. </style>

注意

  • Less: @import 路径不支持@开头的缩写,请使用相对路径引入