主题
LimeBlurView 高斯模糊
- uts 原生高斯模糊插件,兼容uniapp(ios, 安卓)
安装
代码演示
基础使用
可通过blur
属性设置模糊值
html
<l-blur-view class="blur" :blur="5">
<text class="text">高斯模糊</text>
</l-blur-view>
<image class="image" mode="widthFix" src="https://img30.360buyimg.com/sku/jfs/t1/226459/37/16721/264461/662dec54F95822c8b/a87d699d4008c0c0.jpg"></image>
css
.image {
width: 100%;
}
.blur {
position: fixed;
height: 100px;
width: 80%;
top: 10%;
left: 10%;
z-index: 10;
background-color: rgba(0, 0, 0, 0.2);
justify-content: center;
align-items: center;
}
样式使用
也可以通过css里的backdrop-filter: blur(5px)
设置,但这个会在控制台报黄。
html
<l-blur-view class="blur">
<text class="text">高斯模糊</text>
</l-blur-view>
<image class="image" mode="widthFix" src="https://img30.360buyimg.com/sku/jfs/t1/226459/37/16721/264461/662dec54F95822c8b/a87d699d4008c0c0.jpg"></image>
css
.image {
width: 100%;
}
.blur {
position: fixed;
height: 100px;
width: 80%;
top: 10%;
left: 10%;
z-index: 10;
background-color: rgba(0, 0, 0, 0.2);
backdrop-filter: blur(5px);
justify-content: center;
align-items: center;
}
查看示例
- 导入后直接使用这个标签查看演示效果
html
// 代码位于 uni_modules/lime-blur-view/compoents/lime-blur-view
<lime-blur-view />
API
Props
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
blur | 模糊值 | number | `` |
radius | 圆角 | number | `` |