bannerDetails.vue 809 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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.getIndexData()
  24. .then(res=>{
  25. if (res.code === 200) {
  26. const list = res.data?.advs
  27. list.forEach(item => {
  28. if (item.id == id) {
  29. this.dom = item.content
  30. }
  31. })
  32. } else {
  33. this.$refs.uToast.show({
  34. title: res.msg,
  35. type: 'error'
  36. })
  37. }
  38. })
  39. .catch(err => {
  40. this.$refs.uToast.show({
  41. title: '操作失败!',
  42. type: 'error'
  43. })
  44. })
  45. }
  46. }
  47. }
  48. </script>
  49. <style>
  50. </style>