bannerDetails.vue 1.1 KB

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