当前位置:网站首页>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>
边栏推荐
- 产业互联网的产业范畴足够大 消费互联网时代仅是一个局限在互联网行业的存在
- 按键精灵打怪学习-回城买药加血
- R language uses coin package to apply permutation tests to independence problems (permutation tests, whether response variables are independent of groups, are two numerical variables independent, and
- 18_ The wechat video number of wechat applet scrolls and automatically plays the video effect to achieve 2.0
- leetcode:871. Minimum refueling times [Pat has done before + maximum stacking + greed]
- 12_ Implementation of rolling automatic video playback effect of wechat video number of wechat applet
- 测试右移:线上质量监控 ELK 实战
- 2022 Jiangxi Provincial Safety Officer B certificate reexamination examination and Jiangxi Provincial Safety Officer B certificate simulation examination question bank
- Tp6 fast installation uses mongodb to add, delete, modify and check
- [untitled]
猜你喜欢
JS inheritance and prototype chain
Find a benchmark comrade in arms | a million level real-time data platform, which can be used for free for life
MySQL --- 数据库查询 - 条件查询
【面试题】1369- 什么时候不能使用箭头函数?
1696C. Fishingprince plays with array [thinking questions + intermediate state + optimized storage]
给你一个可能存在 重复 元素值的数组 numbers ,它原来是一个升序排列的数组,并按上述情形进行了一次旋转。请返回旋转数组的最小元素。【剑指Offer】
【FH-GFSK】FH-GFSK信号分析与盲解调研究
[FPGA tutorial case 6] design and implementation of dual port RAM based on vivado core
软考信息系统项目管理师_历年真题_2019下半年错题集_上午综合知识题---软考高级之信息系统项目管理师053
一位苦逼程序员的找工作经历
随机推荐
[flutter] icons component (fluttericon Download Icon | customize SVG icon to generate TTF font file | use the downloaded TTF icon file)
Vim 9.0正式发布!新版脚本执行速度最高提升100倍
R language generalized linear model function GLM, (model fit and expression diagnostics), model adequacy evaluation method, use plot function and car package function
测试右移:线上质量监控 ELK 实战
2022 Jiangxi Provincial Safety Officer B certificate reexamination examination and Jiangxi Provincial Safety Officer B certificate simulation examination question bank
Leetcode 2097 - Legal rearrangement of pairs
Niu Ke swipes questions and clocks in
软考信息系统项目管理师_历年真题_2019下半年错题集_上午综合知识题---软考高级之信息系统项目管理师053
关于Fibonacci数列
Arduino DY-SV17F自动语音播报
On Fibonacci sequence
[C language] detailed explanation of pointer and array written test questions
Matlab Doppler effect produces vibration signal and processing
看疫情之下服装企业如何顺势而为
Kivy教程大全之如何在 Kivy 中创建下拉列表
Using tensorboard to visualize the model, data and training process
Kivy tutorial - example of using Matplotlib in Kivy app
tp6快速安装使用MongoDB实现增删改查
MySQL --- 数据库查询 - 基本查询
Esp32 simple speed message test of ros2 (limit frequency)