Automated import of less

When we conduct modular development, in order to improve the reusability of some styles, we will independently encapsulate the style into a style file (for example mixins.less), but when we use it multiple times, we have to import the style file again and again, here Provides a plugin style-resources-loaderway to automate the import of style files

Step 1: Terminal vue add style-resources-loader, and then select the css preprocessing method you need. I use less here.
Step 2: vue.config.jsAutomatically add configuration
insert image description here
in and then in the template file, you can automatically use the style in the file without introducing the corresponding file or Defined style variables or methods out

おすすめ

転載: blog.csdn.net/weixin_47979372/article/details/124281742