7_less中引入其他文件 / 模块

本文介绍了在LESS预处理器中如何引入样式文件及模块,并通过一个三角形样式的案例展示了具体的实现方法。

在less中引入(这玩意你可以引入文件名,加不加好慢的扩展名都可以,或者你直接引入要用的模块之类的):

// 四种导入方式都可以
//@import "triangle.less";
//@import "triangle";
@import "09";
//@import "09.less";

div {
  .triangle(Down, 40px, red);
}

输出:

在这里插入图片描述

我这里的目录结构:

在这里插入图片描述

triangle这个东西在9.less中,

代码:

.triangle(@_,@width,@color) {
  width: 0;
  height: 0;
  border-style: solid solid solid solid;
}

.triangle(Down,@width,@color) {
  border-width: @width;
  border-color: @color transparent transparent transparent;
}
import CarSearch from '@/components/CarSearch' import CarSelect from '@/components/CarSearch/Select' import LpChart from '@/components/Charts/LpChart' import LpCharts from '@/components/Charts/LpCharts' import LpChartDialog from '@/components/Charts/LpChartDialog' import DateDiff from '@/components/DateTimePicker/DateDiff' import LpArea from '@/components/LpArea' import CommonChartHeader from '@/components/CarSearch/CommChartHeader' import CarType from '@/components/CarType' import Editor from '@/components/Editor' import FaultCase from '@/components/Fault/FaultCase' import ConfirmDialog from '@/components/ConfirmDialog' import LpSelect from '@/components/LpSelect' import FuelType from '@/components/FuelType' function globalComponents(Vue) { if (globalComponents.installed) { return } Vue.component('CarSelect', CarSelect) Vue.component('CarSearch', CarSearch) Vue.component('LpChart', LpChart) Vue.component('LpCharts', LpCharts) Vue.component('LpChartDialog', LpChartDialog) Vue.component('DateDiff', DateDiff) Vue.component('LpArea', LpArea) Vue.component('CommonChartHeader', CommonChartHeader) Vue.component('CarType', CarType) Vue.component('Editor', Editor) Vue.component('FaultCase', FaultCase) Vue.component('ConfirmDialog', ConfirmDialog) Vue.component('LpSelect', LpSelect) Vue.component('FuelType', FuelType) } export default globalComponents 迁移之后,Failed to load url /src/components/SvgIcon (resolved id: /src/components/SvgIcon) in D:/project/lp_leapcloud_main_web/src/icons/index.js. Does the file exist? Failed to load url /src/components/CarSearch (resolved id: /src/components/CarSearch) in D:/project/lp_leapcloud_main_web/src/utils/globalComponents.js. Does the file exist? Failed to load url /src/components/CarSearch/Select (resolved id: /src/components/CarSearch/Select) in D:/project/lp_leapcloud_main_web/src/utils/globalComponents.js. Does the file exist? Failed to load url /src/components/Charts/LpChart (resolved id: /src/components/Charts/LpChart) in D:/project/lp_leapcloud_main_web/src/utils/globalComponents.js. Does the file exist? Failed to load url /src/components/Charts/LpChartDialog (resolved id: /src/components/Charts/LpChartDialog) in D:/project/lp_leapcloud_main_web/src/utils/globalComponents.js. Does the file exist? Failed to load url /src/components/Charts/LpCharts (resolved id: /src/components/Charts/LpCharts) in D:/project/lp_leapcloud_main_web/src/utils/globalComponents.js. Does the file exist? Failed to load url /src/components/DateTimePicker/DateDiff (resolved id: /src/components/DateTimePicker/DateDiff) in D:/project/lp_leapcloud_main_web/src/utils/globalComponents.js. Does the file exist? Failed to load url /src/components/LpArea (resolved id: /src/components/LpArea) in D:/project/lp_leapcloud_main_web/src/utils/globalComponents.js. Does the file exist? Failed to load url /src/components/CarSearch/CommChartHeader (resolved id: /src/components/CarSearch/CommChartHeader) in D:/project/lp_leapcloud_main_web/src/utils/globalComponents.js. Does the file exist? Failed to load url /src/components/CarType (resolved id: /src/components/CarType) in D:/project/lp_leapcloud_main_web/src/utils/globalComponents.js. Does the file exist? Failed to load url /src/components/Editor (resolved id: /src/components/Editor) in D:/project/lp_leapcloud_main_web/src/utils/globalComponents.js. Does the file exist? Failed to load url /src/components/Fault/FaultCase (resolved id: /src/components/Fault/FaultCase) in D:/project/lp_leapcloud_main_web/src/utils/globalComponents.js. Does the file exist? Failed to load url /src/components/ConfirmDialog (resolved id: /src/components/ConfirmDialog) in D:/project/lp_leapcloud_main_web/src/utils/globalComponents.js. Does the file exist? Failed to load url /src/components/LpSelect (resolved id: /src/components/LpSelect) in D:/project/lp_leapcloud_main_web/src/utils/globalComponents.js. Does the file exist? Failed to load url /src/components/FuelType (resolved id: /src/components/FuelType) in D:/project/lp_leapcloud_main_web/src/utils/globalComponents.js. Does the file exist?
最新发布
07-01
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

无名之辈无名之辈

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值