notice.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <view class="diy-notice" :style="{ padding: itemData.style.paddingTop + 'px' + ' 10px', background: itemData.style.background }" @click="gotoPages(item)">
  3. <view class="notice-icon"><image :src="itemData.params.icon" mode="aspectFill"></image></view>
  4. <view class="notice-text flex-1 text-ellipsisss">
  5. <text :style="{ color: itemData.style.textColor }">{{ textData }}</text>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. data() {
  12. return {
  13. textData:''
  14. };
  15. },
  16. props: ['itemData'],
  17. created() {
  18. this.textData=this.itemData.params.text;
  19. this.horseRaceLamp();
  20. },
  21. methods: {
  22. horseRaceLamp(){
  23. let self=this;
  24. setTimeout(function(){
  25. let firstWord=self.textData.slice(0,1);
  26. let afterWord=self.textData.slice(1,self.textData.length);
  27. self.textData=afterWord+firstWord;
  28. self.horseRaceLamp();
  29. },200);
  30. },
  31. /*跳转页面*/
  32. gotoPages(e) {
  33. this.gotoPage(e.linkUrl);
  34. }
  35. }
  36. };
  37. </script>
  38. <style>
  39. .diy-notice {
  40. margin: 20rpx;
  41. display: flex;
  42. justify-content: flex-start;
  43. align-items: center;
  44. border-radius: 20rpx;
  45. /* box-shadow: 0 0 8rpx rgba(0, 0, 0, 0.1); */
  46. }
  47. .diy-notice .notice-icon {
  48. width: 32px;
  49. height: 32px;
  50. }
  51. .diy-notice .notice-icon image {
  52. width: 100%;
  53. height: 100%;
  54. }
  55. .diy-notice .notice-text {
  56. overflow: hidden;
  57. white-space: nowrap;
  58. margin-left: 10px;
  59. }
  60. </style>