当前位置:网站首页>Uniapp component -uni notice bar notice bar
Uniapp component -uni notice bar notice bar
2022-07-03 01:27:00 【Song Juntao】
The bulletin board component is mostly used for system notification , Advertising notices and other scenes , Customizable icons , Color , Presentation mode, etc .
Basic usage
Use text
Property to set the contents of the bulletin board
Use singlet
Property to set whether the guide is displayed in a single line
<uni-notice-bar single text="[ A single ] This is a NoticeBar Notice board , This is a NoticeBar Notice board , This is a NoticeBar Notice board "></uni-notice-bar>
<uni-notice-bar text="[ Multiple lines ] This is a NoticeBar Notice board , This is a NoticeBar Notice board , This is a NoticeBar Notice board , This is a NoticeBar Notice board "></uni-notice-bar>
# Text scrolling
Use scrollable
Property to set whether text scrolls
<uni-notice-bar scrollable single text="[ A single ] This is a NoticeBar Notice board , This is a NoticeBar Notice board , This is a NoticeBar Notice board "></uni-notice-bar>
# Show icons
Use showIcon
Property to set whether to display icons
<uni-notice-bar showIcon text="[ Multiple lines ] This is a NoticeBar Notice board , This is a NoticeBar Notice board , This is a NoticeBar Bulletin board this is NoticeBar Notice board , This is a NoticeBar Notice board , This is a NoticeBar Notice board "></uni-notice-bar>
# Show close button
Use showClose
Property to set whether to display the close icon
<uni-notice-bar showClose showIcon text=" This is a NoticeBar Notice board , This is a NoticeBar Notice board , This is a NoticeBar Notice board "></uni-notice-bar>
# To view more
Use showGetMore
Property to set whether to display more icons on the right
Use moreText
Property settings to see more text
<uni-notice-bar @getmore="getMore" showGetMore moreText=" To view more " single text="[ A single ] This is a NoticeBar Notice board , This is a NoticeBar Notice board , This is a NoticeBar Notice board "></uni-notice-bar>
Be careful
If you need to get content asynchronously, you need to use v-if
Control ,<uni-notice-bar v-if="text" :text="text"></uni-notice-bar>
#NoticeBar API
#NoticeBar Props
Property name | type | The default value is | explain |
---|---|---|---|
speed | Number | 100 | The speed at which the text scrolls , Default 100px/ second |
text | String | - | According to the text |
background-color | String | #fffbe8 | The background color |
color | String | #de8c17 | Text color |
moreColor | String | #999999 | See more text colors |
moreText | String | - | Set up “ To view more ” The text of |
single | Boolean | false | Whether it's a single line |
scrollable | Boolean | false | Whether to scroll , by true when ,NoticeBar It is a single line |
showIcon | Boolean | false | Whether the left horn icon is displayed |
showClose | Boolean | false | Whether to display the left close button |
showGetMore | Boolean | false | Whether to display the right view more icons , by true when ,NoticeBar It is a single line |
#NoticeBar Events
Event name | explain | Return value |
---|---|---|
@click | Click on NoticeBar Triggering event | - |
@close | close NoticeBar Triggering event | - |
@getmore | Click on ” To view more “ Trigger event | - |
# Example
Be careful
The example relies on uni-card
uni-section
uni-scss
Wait for multiple components , Copying the sample code directly will not work .
succeed in inviting sb. Component download page (opens new window), Select... On the right side of the page Use HBuilderX Import the sample project
, Experience the complete component example .
Template
Script
Style
<template>
<view class="container">
<uni-card is-full :is-shadow="false">
<text class="uni-h6"> The bulletin board component is mostly used for system notification , Advertising notices and other scenes , Customizable icons , Color , Presentation mode, etc .</text>
</uni-card>
<uni-section title=" Multi line display " type="line">
<uni-notice-bar text="uni-app Version is officially released , Develop once , At the same time iOS、Android、H5、 Wechat applet 、 Alipay applet 、 Baidu applet 、 Headline applet, etc 7 Large platform ." />
</uni-section>
<uni-section title=" Single line display " subTitle=" Use single The attribute line shows the notification " type="line">
<uni-notice-bar single text="uni-app Version is officially released , Develop once , At the same time iOS、Android、H5、 Wechat applet 、 Alipay applet 、 Baidu applet 、 Headline applet, etc 7 Large platform ." />
</uni-section>
<uni-section title=" Show icons " subTitle=" Use show-icon Property displays the left trumpet icon " type="line">
<uni-notice-bar show-icon text="uni-app Release , Develop once 、7 End coverage !" />
</uni-section>
<uni-section title=" Text scrolling " subTitle=" Use scrollable Property scrolls the announcement , here single Property will fail , Always single line " type="line">
<uni-notice-bar show-icon scrollable
text="uni-app Version is officially released , Develop once , At the same time iOS、Android、H5、 Wechat applet 、 Alipay applet 、 Baidu applet 、 Headline applet, etc 7 Large platform ." />
</uni-section>
<uni-section title=" To view more " subTitle=" Use show-get-more Show more , here single Property will fail , Always single line , If not configured more-text attribute , Arrow icons will be displayed "
type="line">
<uni-notice-bar show-get-more show-icon text=" Year end gift :uni-app1.4 New Baidu 、 Alipay applet . The plug-in market is heavily launched !" @getmore="getMore" />
<uni-notice-bar show-get-more show-icon more-text=" To view more " text=" Year end gift :uni-app1.4 New Baidu 、 Alipay applet . The plug-in market is heavily launched !"
@getmore="getMore" />
</uni-section>
<uni-section title=" Change the color " type="line">
<uni-notice-bar single color="#2979FF" background-color="#EAF2FF"
text="uni-app 1.6 Version is officially released , Develop once , At the same time iOS、Android、H5、 Wechat applet 、 Alipay applet 、 Baidu applet 、 Headline applet, etc 7 Large platform ." />
</uni-section>
<uni-section title=" close button " subTitle=" Use show-close attribute , Notifications can be turned off " type="line">
<uni-notice-bar show-close single text="HBuilderX 1.0 Official release !uni-app Achieve milestone breakthrough achieve milestone breakthrough !" />
</uni-section>
</view>
</template>
边栏推荐
- Machine learning terminology
- Key wizard hit strange learning - automatic path finding back to hit strange points
- [system analyst's road] Chapter V double disk software engineering (development model development method)
- [principles of multithreading and high concurrency: 2. Solutions to cache consistency]
- uniapp组件-uni-notice-bar通告栏
- Compare version number
- C#应用程序界面开发基础——窗体控制(1)——Form窗体
- [untitled]
- 力扣 204. 计数质数
- 按键精灵打怪学习-前台和内网发送后台验证码
猜你喜欢
力扣 204. 计数质数
[principles of multithreading and high concurrency: 2. Solutions to cache consistency]
MySQL
1696C. Fishingprince plays with array [thinking questions + intermediate state + optimized storage]
【无标题】
[my advanced journey of OpenGL learning] collation of Euler angle, rotation order, rotation matrix, quaternion and other knowledge
机器学习术语
Matlab Doppler effect produces vibration signal and processing
Esp32 simple speed message test of ros2 (limit frequency)
dotConnect for PostgreSQL数据提供程序
随机推荐
How wide does the dual inline for bread board need?
[self management] time, energy and habit management
d,ldc構建共享庫
kivy教程之在 Kivy App 中使用 matplotlib 的示例
MySQL basic usage 02
MySQL
MySQL foundation 05 DML language
如今少年已归来,人间烟火气最抚凡人心 复工了~
C#应用程序界面开发基础——窗体控制(4)——选择类控件
数学知识:Nim游戏—博弈论
Swiftui component Encyclopedia: using scenekit and swiftui to build interactive 3D pie charts (tutorial with source code)
【C语言】指针与数组笔试题详解
18_ The wechat video number of wechat applet scrolls and automatically plays the video effect to achieve 2.0
Meituan dynamic thread pool practice ideas, open source
[shutter] animation animation (shutter animation type | the core class of shutter animation)
【我的OpenGL学习进阶之旅】关于欧拉角、旋转顺序、旋转矩阵、四元数等知识的整理
Niu Ke swipes questions and clocks in
Excel if formula determines whether the two columns are the same
The latest analysis of tool fitter (technician) in 2022 and the test questions and analysis of tool fitter (technician)
What are the trading forms of spot gold and what are the profitable advantages?