Noticebar
组件类型:UxNoticebarComponentPublicInstance
支持水平滚动、垂直翻页,可配置滚动速度、右侧按钮
平台兼容性
UniApp X
Android | iOS | web | 鸿蒙 Next | 小程序 |
---|---|---|---|---|
√ | √ | √ | x | √ |
UniApp Vue Nvue
Android | iOS | web | 鸿蒙 Next | 小程序 |
---|---|---|---|---|
x | x | √ | x | x |
Props
属性名 | 类型 | 默认值 | 说明 |
---|---|---|---|
texts | Array | 通告内容 | |
theme | String | 主题颜色 | |
color | String | $ux.Conf.fontColor | 文字颜色 |
darkColor | String | 深色none-不显示,auto-自动适配深色模式,其他-颜色 | |
size | Any | $ux.Conf.fontSize | 内容文字大小 |
icon | String | volumenotice-filled | 左侧图标 |
rightIcon | String | 右侧图标 | |
iconSize | Any | $ux.Conf.fontSize | 图标尺寸 |
iconColor | String | $ux.Conf.fontColor | 图标颜色 |
background | String | $ux.Conf.backgroundColor | 背景颜色 |
backgroundDark | String | 深色none-不显示,auto-自动适配深色模式,其他-颜色 | |
radius | Any | 5 | 圆角 |
scrollable | Boolean | true | 开启滚动 |
direction | String | row | 滚动方向 |
speed | Number | 60px/秒 | 文字水平垂直滚动的速度 |
mutiline | Boolean | 是否多行显示,多行则无滚动效果 | |
margin | Array | 边距[上右下左][上下左右][上下左右] | |
mt | Any | 距上单位px | |
mr | Any | 距右单位px | |
mb | Any | 距下单位px | |
ml | Any | 距左单位px | |
padding | Array | 填充[上右下左][上下左右][上下左右] | |
pt | Any | 上内边距单位px | |
pr | Any | 右内边距单位px | |
pb | Any | 下内边距单位px | |
pl | Any | 左内边距单位px | |
xstyle | Array | 自定义样式 |
theme
值 | 说明 |
---|---|
primary | 主色 |
warning | 警告 |
success | 成功 |
error | 错误 |
info | 文本 |
darkColor
值 | 说明 |
---|---|
none不显示 | |
auto自动适配深色模式 | |
color其他颜色 |
backgroundDark
值 | 说明 |
---|---|
none不显示 | |
auto自动适配深色模式 | |
color其他颜色 |
direction
值 | 说明 |
---|---|
row水平滚动 | |
col垂直翻页 |
Events
事件名 | 说明 | 参数 |
---|---|---|
click | 点击时触发 | |
handle | 点击右侧按钮时触发 |
示例代码
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="支持水平滚动、垂直翻页,可配置滚动速度、右侧按钮"></ux-text>
</ux-card>
<ux-card direction="column" icon="arrowright" title="主题" :bold="true">
<ux-text text="多种主题可配置,适配暗黑模式" :mb="15"></ux-text>
<ux-col>
<ux-noticebar :texts="[text]"></ux-noticebar>
<ux-noticebar theme="success" :texts="[text]" :mt="10"></ux-noticebar>
<ux-noticebar theme="primary" :texts="[text]" right-icon="close" background="red" :mt="10"></ux-noticebar>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="垂直翻页" :bold="true">
<ux-text text="支持垂直翻页" :mb="15"></ux-text>
<ux-col>
<ux-noticebar :texts="texts" direction="col"></ux-noticebar>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="滚动速度" :bold="true">
<ux-text text="支持配置滚动速度" :mb="15"></ux-text>
<ux-col>
<ux-noticebar :texts="texts" direction="col" :speed="120"></ux-noticebar>
<ux-noticebar theme="success" :texts="[text]" :speed="120" :mt="10"></ux-noticebar>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="多行显示" :bold="true">
<ux-text text="支持多行显示,无滚动效果" :mb="15"></ux-text>
<ux-col>
<ux-noticebar :texts="[text]" :mutiline="true" background="#f0f0f0" color="red" icon-color="red"></ux-noticebar>
</ux-col>
</ux-card>
<ux-placeholder :height="200">
<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-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="支持水平滚动、垂直翻页,可配置滚动速度、右侧按钮"></ux-text>
</ux-card>
<ux-card direction="column" icon="arrowright" title="主题" :bold="true">
<ux-text text="多种主题可配置,适配暗黑模式" :mb="15"></ux-text>
<ux-col>
<ux-noticebar :texts="[text]"></ux-noticebar>
<ux-noticebar theme="success" :texts="[text]" :mt="10"></ux-noticebar>
<ux-noticebar theme="primary" :texts="[text]" right-icon="close" background="red" :mt="10"></ux-noticebar>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="垂直翻页" :bold="true">
<ux-text text="支持垂直翻页" :mb="15"></ux-text>
<ux-col>
<ux-noticebar :texts="texts" direction="col"></ux-noticebar>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="滚动速度" :bold="true">
<ux-text text="支持配置滚动速度" :mb="15"></ux-text>
<ux-col>
<ux-noticebar :texts="texts" direction="col" :speed="120"></ux-noticebar>
<ux-noticebar theme="success" :texts="[text]" :speed="120" :mt="10"></ux-noticebar>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="多行显示" :bold="true">
<ux-text text="支持多行显示,无滚动效果" :mb="15"></ux-text>
<ux-col>
<ux-noticebar :texts="[text]" :mutiline="true" background="#f0f0f0" color="red" icon-color="red"></ux-noticebar>
</ux-col>
</ux-card>
<ux-placeholder :height="200">
<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-page>
</template>
ts
<script setup>
import * as plus from '@/uni_modules/ux-plus'
const title = ref('')
const text = 'UxFrame是Uniapp-X 低代码高性能UI框架! 了解详情请访问官网:https://www.uxframe.cn'
const texts = ['UxFrame是Uniapp-X 低代码高性能UI框架! ','了解详情请访问官网:https://www.uxframe.cn']
const showDoc = ref(false)
function onDoc() {
plus.openWeb({
title: '在线文档',
url: 'https://www.uxframe.cn/component/noticebar.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 text = 'UxFrame是Uniapp-X 低代码高性能UI框架! 了解详情请访问官网:https://www.uxframe.cn'
const texts = ['UxFrame是Uniapp-X 低代码高性能UI框架! ','了解详情请访问官网:https://www.uxframe.cn']
const showDoc = ref(false)
function onDoc() {
plus.openWeb({
title: '在线文档',
url: 'https://www.uxframe.cn/component/noticebar.html',
// blur: 1,
success: () => {
showDoc.value = true
},
complete: () => {
showDoc.value = false
}
})
}
onLoad((e: OnLoadOptions) => {
title.value = e['title'] ?? ''
})
</script>
css
<style lang="scss">
</style>
<style lang="scss">
</style>