graceSpeaker.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template name="graceSpeaker">
  2. <view class="grace-swiper-msg">
  3. <view class="grace-swiper-msg-icon" :class="[iconClass]" :style="{color:iconColor}"></view>
  4. <swiper class="grace-swiper-msg-swiper"
  5. :vertical="vertical" @change="change" autoplay="true" circular="true" :interval="interval" :style="{height:height}">
  6. <swiper-item class="grace-swiper-item"
  7. v-for="(item, index) in msgs" :key="index" :style="{height:height}">
  8. <navigator class="grace-swiper-msg-navigator"
  9. :url="item.url" :open-type="item.opentype"
  10. :style="{fontSize:fontSize, fontWeight:fontWeight, color:fontColor, height:height, lineHeight:height}">{{item.title}}</navigator>
  11. </swiper-item>
  12. </swiper>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. name: "graceSpeaker",
  18. props: {
  19. msgs : {
  20. type : Array,
  21. default : function(){return [];}
  22. },
  23. iconClass : {
  24. type : String,
  25. default : ""
  26. },
  27. iconColor : {
  28. type : String,
  29. default : "#3688FF"
  30. },
  31. interval : {
  32. type : Number,
  33. default: 5000
  34. },
  35. vertical : {
  36. type : Boolean,
  37. default : true
  38. },
  39. fontSize : {
  40. type : String,
  41. default : "26rpx"
  42. },
  43. fontColor : {
  44. type : String,
  45. default : "#333333"
  46. },
  47. fontWeight : {
  48. type : String,
  49. default : ""
  50. },
  51. height:{
  52. type : String,
  53. default : "60rpx"
  54. }
  55. },
  56. methods:{
  57. change:function (index) {
  58. this.$emit('change', index.detail.current);
  59. }
  60. }
  61. }
  62. </script>
  63. <style scoped>
  64. .grace-swiper-msg{width:100%; display:flex; flex-wrap:nowrap; align-items:center;}
  65. .grace-swiper-msg-icon{margin-right:16rpx; display:inline-block; flex-shrink:0;}
  66. .grace-swiper-msg-swiper{width:100%; height:60rpx; overflow:hidden;}
  67. .grace-swiper-item{overflow:hidden;}
  68. .grace-swiper-msg-navigator{line-height:60rpx; overflow:hidden;}
  69. </style>