notice-bar.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <view class="container">
  3. <uni-card is-full :is-shadow="false">
  4. <text class="uni-h6">通告栏组件多用于系统通知,广告通知等场景,可自定义图标,颜色,展现方式等。</text>
  5. </uni-card>
  6. <uni-section title="多行显示" type="line">
  7. <uni-notice-bar text="uni-app 版正式发布,开发一次,同时发布iOS、Android、H5、微信小程序、支付宝小程序、百度小程序、头条小程序等7大平台。" />
  8. </uni-section>
  9. <uni-section title="单行显示" subTitle="使用 single 属性单行显示通知" type="line">
  10. <uni-notice-bar single text="uni-app 版正式发布,开发一次,同时发布iOS、Android、H5、微信小程序、支付宝小程序、百度小程序、头条小程序等7大平台。" />
  11. </uni-section>
  12. <uni-section title="显示图标" subTitle="使用 show-icon 属性显示左侧小喇叭图标" type="line">
  13. <uni-notice-bar show-icon text="uni-app发布,开发一次、7端覆盖!" />
  14. </uni-section>
  15. <uni-section title="文字滚动" subTitle="使用 scrollable 属性使通告滚动,此时 single 属性将失效,始终单行显示" type="line">
  16. <uni-notice-bar show-icon scrollable text="uni-app 版正式发布,开发一次,同时发布iOS、Android、H5、微信小程序、支付宝小程序、百度小程序、头条小程序等7大平台。" />
  17. </uni-section>
  18. <uni-section title="查看更多" subTitle="使用 show-get-more 显示更多,此时 single 属性将失效,始终单行显示,如不配置 more-text 属性 ,将显示箭头图标" type="line">
  19. <uni-notice-bar show-get-more show-icon text="年末大礼:uni-app1.4 新增百度、支付宝小程序。插件市场重磅上线!"
  20. @getmore="getMore" />
  21. <uni-notice-bar show-get-more show-icon more-text="查看更多" text="年末大礼:uni-app1.4 新增百度、支付宝小程序。插件市场重磅上线!"
  22. @getmore="getMore" />
  23. </uni-section>
  24. <uni-section title="修改颜色" type="line">
  25. <uni-notice-bar single color="#2979FF" background-color="#EAF2FF" text="uni-app 1.6版正式发布,开发一次,同时发布iOS、Android、H5、微信小程序、支付宝小程序、百度小程序、头条小程序等7大平台。" />
  26. </uni-section>
  27. <uni-section title="关闭按钮" subTitle="使用 show-close 属性,可关闭通知" type="line">
  28. <uni-notice-bar show-close single text="HBuilderX 1.0正式发布!uni-app实现里程碑突破实现里程碑突破!" />
  29. </uni-section>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. components: {},
  35. data() {
  36. return {}
  37. },
  38. created() {},
  39. methods: {
  40. getMore() {
  41. uni.showToast({
  42. title: '点击查看更多',
  43. icon: 'none'
  44. })
  45. }
  46. }
  47. }
  48. </script>
  49. <style lang="scss">
  50. .container {
  51. /* #ifndef APP-NVUE */
  52. position: absolute;
  53. left: 0;
  54. right:0;
  55. top: 0;
  56. bottom: 0;
  57. /* #endif */
  58. }
  59. </style>