bannerDetails.vue 863 B

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