policyNewsDetails.vue 983 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <view class="ql-editor">
  3. <u-parse :html="content"></u-parse>
  4. <u-toast ref="uToast" />
  5. </view>
  6. </template>
  7. <script>
  8. export default {
  9. data() {
  10. return {
  11. content: ''
  12. };
  13. },
  14. onLoad(page) {
  15. if (page.artId) {
  16. this.getDetails(page.artId);
  17. }
  18. },
  19. onShow() {},
  20. methods: {
  21. // 获取详情
  22. getDetails(id) {
  23. this.$u.api
  24. .getPolicyNewsDetails({
  25. id: id
  26. })
  27. .then((res) => {
  28. console.log('getNewsDetails', JSON.parse(JSON.stringify(res)));
  29. if (res.code === 200) {
  30. console.log(res.data);
  31. this.content = res.data.artContent;
  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>