Blur
组件类型:UxBlurComponentPublicInstance
实时计算毛玻璃效果 支持android、ios、web
平台兼容性
UniApp X
Android | iOS | web | 鸿蒙 Next | 小程序 |
---|---|---|---|---|
√ | √ | √ | x | √ |
UniApp Vue Nvue
Android | iOS | web | 鸿蒙 Next | 小程序 |
---|---|---|---|---|
x | x | √ | x | x |
Props
属性名 | 类型 | 默认值 | 说明 |
---|---|---|---|
view | Any | 指定模糊的视图通过el.getAndroidView()、el.getIOSView()获取 | |
radius | Number | 10 | 模糊半径 |
color | String | white | 颜色 |
cornerRadius | Number | 0 | 圆角 |
Events
事件名 | 说明 | 参数 |
---|---|---|
click | 被点击时触发 |
示例代码
html
<template>
<ux-page :stack="showDoc">
<ux-navbar :title="title" :bold="true">
<template v-slot:right>
<!-- #ifndef MP -->
<ux-button theme="text" icon="/static/tip.png" :icon-size="22" @click="onDoc()"></ux-button>
<!-- #endif -->
</template>
</ux-navbar>
<ux-scroll>
<ux-card direction="column" icon="flag-filled" title="高斯模糊" :bold="true">
<ux-text text="实时计算毛玻璃效果 支持android、ios、web"></ux-text>
</ux-card>
<ux-card direction="column" icon="arrowright" title="高斯模糊" :bold="true">
<ux-text text="上下滑动, 查看毛玻璃效果" :mb="15"></ux-text>
<ux-image src="/static/logo.png"></ux-image>
</ux-card>
<ux-card direction="column" icon="arrowright" title="高斯模糊" :bold="true">
<ux-text text="上下滑动, 查看毛玻璃效果" :mb="15"></ux-text>
<ux-image src="/static/logo.png"></ux-image>
</ux-card>
<ux-card direction="column" icon="arrowright" title="高斯模糊" :bold="true">
<ux-text text="上下滑动, 查看毛玻璃效果" :mb="15"></ux-text>
<ux-image src="/static/logo.png"></ux-image>
</ux-card>
<ux-placeholder :height="300">
<ux-row justify="center" align="center" style="height: 100%;">
<ux-text prefix-icon="soapbubble-filled" text="真的没有了~"></ux-text>
</ux-row>
</ux-placeholder>
</ux-scroll>
<ux-blur class="blur"></ux-blur>
</ux-page>
</template>
<template>
<ux-page :stack="showDoc">
<ux-navbar :title="title" :bold="true">
<template v-slot:right>
<!-- #ifndef MP -->
<ux-button theme="text" icon="/static/tip.png" :icon-size="22" @click="onDoc()"></ux-button>
<!-- #endif -->
</template>
</ux-navbar>
<ux-scroll>
<ux-card direction="column" icon="flag-filled" title="高斯模糊" :bold="true">
<ux-text text="实时计算毛玻璃效果 支持android、ios、web"></ux-text>
</ux-card>
<ux-card direction="column" icon="arrowright" title="高斯模糊" :bold="true">
<ux-text text="上下滑动, 查看毛玻璃效果" :mb="15"></ux-text>
<ux-image src="/static/logo.png"></ux-image>
</ux-card>
<ux-card direction="column" icon="arrowright" title="高斯模糊" :bold="true">
<ux-text text="上下滑动, 查看毛玻璃效果" :mb="15"></ux-text>
<ux-image src="/static/logo.png"></ux-image>
</ux-card>
<ux-card direction="column" icon="arrowright" title="高斯模糊" :bold="true">
<ux-text text="上下滑动, 查看毛玻璃效果" :mb="15"></ux-text>
<ux-image src="/static/logo.png"></ux-image>
</ux-card>
<ux-placeholder :height="300">
<ux-row justify="center" align="center" style="height: 100%;">
<ux-text prefix-icon="soapbubble-filled" text="真的没有了~"></ux-text>
</ux-row>
</ux-placeholder>
</ux-scroll>
<ux-blur class="blur"></ux-blur>
</ux-page>
</template>
ts
<script setup>
import * as plus from '@/uni_modules/ux-plus'
const title = ref('')
const showDoc = ref(false)
function onDoc() {
plus.openWeb({
title: '在线文档',
url: 'https://www.uxframe.cn/component/blur.html',
// blur: 1,
success: () => {
showDoc.value = true
},
complete: () => {
showDoc.value = false
}
})
}
onLoad((e: OnLoadOptions) => {
title.value = e['title'] ?? ''
})
</script>
<script setup>
import * as plus from '@/uni_modules/ux-plus'
const title = ref('')
const showDoc = ref(false)
function onDoc() {
plus.openWeb({
title: '在线文档',
url: 'https://www.uxframe.cn/component/blur.html',
// blur: 1,
success: () => {
showDoc.value = true
},
complete: () => {
showDoc.value = false
}
})
}
onLoad((e: OnLoadOptions) => {
title.value = e['title'] ?? ''
})
</script>
css
<style lang="scss">
.blur {
position: absolute;
top: 200px;
width: 100%;
height: 120px;
}
</style>
<style lang="scss">
.blur {
position: absolute;
top: 200px;
width: 100%;
height: 120px;
}
</style>