bannerDetails.vue 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <!-- 轮播详情 -->
  3. <view>
  4. <u-navbar back-text="" title="" back-icon-color="#FFFFFF" :background="{ background: '#3D5D4C' }" :border-bottom="false"></u-navbar>
  5. <u-parse :html="dom"></u-parse>
  6. <u-toast ref="uToast" />
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. data() {
  12. return {
  13. dom: '',
  14. type: 0
  15. }
  16. },
  17. onLoad(page) {
  18. if (page.id) {
  19. this.getDetails(page.id);
  20. this.type = page.type
  21. }
  22. },
  23. methods: {
  24. // 获取详情
  25. getDetails(id) {
  26. this.$u.api.indexApi.indexBannerListApi({ type: this.type }).then(res => {
  27. if (res.code === 200) {
  28. const list = res.data
  29. list.forEach(item => {
  30. if (item.id == id) {
  31. this.dom = item.content
  32. }
  33. })
  34. } else {
  35. this.$refs.uToast.show({
  36. title: res.msg,
  37. type: 'error'
  38. })
  39. }
  40. })
  41. .catch(err => {
  42. this.$refs.uToast.show({
  43. title: '操作失败!',
  44. type: 'error'
  45. })
  46. })
  47. }
  48. }
  49. }
  50. </script>
  51. <style>
  52. page {
  53. padding: 24rpx;
  54. }
  55. </style>