12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <template>
- <view class="ql-editor">
- <u-parse :html="content"></u-parse>
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- content: ''
- };
- },
- onLoad(page) {
- if (page.artId) {
- this.getDetails(page.artId);
- }
- },
- onShow() {},
- methods: {
- // 获取详情
- getDetails(id) {
- this.$u.api
- .getPolicyNewsDetails({
- id: id
- })
- .then((res) => {
- console.log('getNewsDetails', JSON.parse(JSON.stringify(res)));
- if (res.code === 200) {
- console.log(res.data);
- this.content = res.data.artContent;
- } else {
- this.$refs.uToast.show({
- title: res.msg,
- type: 'error'
- });
- }
- })
- .catch((err) => {
- this.$refs.uToast.show({
- title: '操作失败!',
- type: 'error'
- });
- });
- }
- }
- };
- </script>
|