Vue下渐变效果有时候失效
2024-09-06 05:54:54
记录一个问题:我在项目中给按钮设置一个渐变属性,调试的时候有时候有效果,有时候又没有,代码如下:
.training-right-bmz {
background: -webkit-linear-gradient(left, #21dfad, #06b7ba);
background: -moz-linear-gradient(left, #21dfad, #06b7ba);
background: -ms-linear-gradient(left, #21dfad, #06b7ba);
background: -o-linear-gradient(left, #21dfad, #06b7ba);
background: linear-gradient(left, #21dfad, #06b7ba);
border-radius: 100px 0 0 100px;
border: none;
color: #fff;
font-size: 14px;
position: absolute;
padding: 4px 12px;
right: 0px;
top: 34px;
}
打开浏览器调试看了下,渐变属性那里变成了感叹号,效果没有渲染出来,想了N多方法还是没有戏,
、、、、
下班回来百度,看到一个大佬的文章,https://www.cnblogs.com/sxgxiaoge/p/9646949.html(Vue项目打包上线后,所使用的css3渐变属性丢失解决方案),突然觉得好像我在写样式代码的时候,有注释的时候,渐变是出来的,没有注释有时候渐变没有了,于是按照大佬的方法:“可能是optimize-css-assets-webpack-plugin
这个插件的问题,其实解决办法很简单,只需要在这个属性前后加一个特殊注释即可”,直接加注释,
.training-right-bmz {
// background: #21dfad;
background: -webkit-linear-gradient(left, #21dfad, #06b7ba);
background: -moz-linear-gradient(left, #21dfad, #06b7ba);
background: -ms-linear-gradient(left, #21dfad, #06b7ba);
background: -o-linear-gradient(left, #21dfad, #06b7ba);
background: linear-gradient(left, #21dfad, #06b7ba);
border-radius: 100px 0 0 100px;
border: none;
color: #fff;
font-size: 14px;
position: absolute;
padding: 4px 12px;
right: 0px;
top: 34px;
}
发现渐变出来了,有点懵逼,不晓得是不是因为插件的原因还是啥,先记录一下,等明天给测试看看效果还有没有
.
.
发现问题:随便注释还是不行,直接用大佬的注释代码试试看,如下:
.btn-baomingzhong {
/*! autoprefixer: off */
background: -webkit-gradient(
linear,
100% 0,
0 0,
from(#21dfad),
to(#06b7ba)
);
background: -webkit-linear-gradient(left, #21dfad, #06b7ba);
/* autoprefixer: on */
background: -moz-linear-gradient(left, #21dfad, #06b7ba);
background: -ms-linear-gradient(left, #21dfad, #06b7ba);
background: -o-linear-gradient(left, #21dfad, #06b7ba);
background: linear-gradient(left, #21dfad, #06b7ba);
border-radius: 100px 0 0 100px;
border: none;
color: #fff;
font-size: 14px;
position: absolute;
padding: 4px 12px;
right: 0px;
}
明天看哈
最新文章
- ActiveMQ中的Destination高级特性(一)
- Android中Bitmap,byte[],Drawable相互转化
- Loadrunner的自定义监控器
- 《统计推断(Statistical Inference)》读书笔记——第6章 数据简化原理
- codeforces 361 A - Mike and Cellphone
- 洛谷P1508 Likecloud-吃、吃、吃
- 高通安卓调试LCD几方面总结
- Java(JVM运行时)各种内存区域详解及扩展
- dd 命令实时进度监控
- Integer类的装箱和拆箱到底是怎样实现的?
- Jenkins 十一: 构建Maven项目
- 酷派D530刷机指引
- USB系列之八:透过ASPI执行SCSI命令
- H-Index,H-Index II
- 《Linux Device Drivers》第十八章 TTY驱动程序——note
- koa2学习(一)
- [LeetCode] Rotated Digits 旋转数字
- spring BeanPostProcessor
- list(列表) python
- 优雅的重载toString方法,打印对象内容而不是打印内存地址的方法
热门文章
- vue项目工具文件utils.js javascript常用工具类,javascript常用工具类,util.js
- Python判断一个字符串中是否存在多个子串中的一个
- Java技术专区-虚拟机系列-类加载机制(类的初始化)
- c# 盖尔-沙普利算法的改进
- go 学习Printf
- enovia PLM: add characteristic to both prototype and product
- Pyinstaller 打包exe 报错 ";failed to execute script XXX";的一种解决方案
- Codeforces 1111E DP + 树状数组 + LCA + dfs序
- mongoose 常用数据库操作 查询
- python基础和编程库