bannerDetails.vue 922 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. type: 0
  14. }
  15. },
  16. onLoad(page) {
  17. if (page.id) {
  18. this.getDetails(page.id);
  19. this.type = page.type
  20. }
  21. },
  22. methods: {
  23. // 获取详情
  24. getDetails(id) {
  25. this.$u.api.indexApi.indexBannerListApi({ type: this.type }).then(res => {
  26. if (res.code === 200) {
  27. const list = res.data
  28. list.forEach(item => {
  29. if (item.id == id) {
  30. this.dom = item.content
  31. }
  32. })
  33. } else {
  34. this.$refs.uToast.show({
  35. title: res.msg,
  36. type: 'error'
  37. })
  38. }
  39. })
  40. .catch(err => {
  41. this.$refs.uToast.show({
  42. title: '操作失败!',
  43. type: 'error'
  44. })
  45. })
  46. }
  47. }
  48. }
  49. </script>
  50. <style>
  51. page {
  52. padding: 24rpx;
  53. }
  54. </style>