<template> <!-- 轮播详情 --> <view> <u-parse :html="dom"></u-parse> <u-toast ref="uToast" /> </view> </template> <script> export default { data() { return { dom: '' }; }, onLoad(page) { if (page.id) { this.getDetails(page.id); } }, methods: { // 获取详情 getDetails(id) { this.$u.api .getIndexData() .then((res) => { if (res.code === 200) { const list = res.data?.advs; list.forEach((item) => { if (item.id == id) { this.dom = item.content; } }); } else { this.$refs.uToast.show({ title: res.msg, type: 'error' }); } }) .catch((err) => { this.$refs.uToast.show({ title: '操作失败!', type: 'error' }); }); } } }; </script> <style> page { padding: 24rpx; } </style>