https://www.npmjs.com/package/sass-runtime-tool
yarn add sass-runtime-tool -D
# or
npm i -D sass-runtime-tool
@use "sass-runtime-tool/all.scss" as *;
// 改变 placeholder 的颜色和大小
.input {
@include placeholder(red) {
font-size: 12px;
}
}
/* 或者 */
.input {
@include placeholder {
color: red;
font-size: 12px;
}
}
// 下拉框小三角
.triangle {
&::before {
content: "";
display: inline-block;
@include triangle;
}
&::after {
content: "";
display: inline-block;
@include triangle("left", 26px, green);
}
}
.triangle-2 {
@include triangle($color: blue);
}
// 超出显示省略号
.ellipsis {
width: 100px;
// 超过3行就显示省略号
@include ellipsis(3);
}
.ellipsis-2 {
width: 100px;
@include ellipsis;
}
// 正方形
.square {
@include square(100px);
}
// 清除浮动
.right {
@include clearfix;
}
// 清除 margin 折叠
.box {
@include margin-recover;
}
// 去除 <input type="number" /> 右边的箭头
:where(input[type="number"]) {
@include hide-arrow;
}
// 隐藏滚动条
.scroll {
height: 100px;
@include hide-scroll;
}