policyNewsDetails.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. },
  21. methods:{
  22. // 获取详情
  23. getDetails(id) {
  24. this.$u.api.getPolicyNewsDetails({id:id})
  25. .then(res=>{
  26. console.log('getNewsDetails',JSON.parse(JSON.stringify(res)));
  27. if (res.code === 200) {
  28. console.log(res.data);
  29. this.content = res.data.artContent;
  30. } else {
  31. this.$refs.uToast.show({
  32. title: res.msg,
  33. type: 'error'
  34. })
  35. }
  36. })
  37. .catch(err => {
  38. this.$refs.uToast.show({
  39. title: '操作失败!',
  40. type: 'error'
  41. })
  42. })
  43. }
  44. }
  45. }
  46. </script>
  47. <style lang="scss" scoped>
  48. // page{padding: 24rpx;}
  49. // @import './policyNewsDetails.scss'
  50. @import '@/static/css/quill.bubble.scss';
  51. @import '@/static/css/quill.core.scss';
  52. @import '@/static/css/quill.snow.scss';
  53. </style>