forked from TALL/check-work
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.4 KiB
63 lines
1.4 KiB
<!--
|
|
Copyright (c) 2020.
|
|
author: song
|
|
email: 15235360226@163.com
|
|
-->
|
|
|
|
<template>
|
|
<div>
|
|
<div class="words-content">
|
|
<span class="font-16 white line-height-36" v-dompurify-html="content"></span>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapState, mapMutations, mapActions } from 'vuex';
|
|
import { getPageDetail } from 'config/api';
|
|
|
|
export default {
|
|
name: 'RichText',
|
|
props: {
|
|
title: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
},
|
|
|
|
data() {
|
|
return { content: '' };
|
|
},
|
|
|
|
// computed: mapState('home', ['titleCode']),
|
|
|
|
async created() {
|
|
// this.setContent('');
|
|
await this.getPageDetail(this.title);
|
|
},
|
|
|
|
methods: {
|
|
// ...mapMutations('home', ['setContent']),
|
|
// ...mapActions('home', ['getPageDetail']),
|
|
|
|
async getPageDetail(titleCode) {
|
|
try {
|
|
const params = { param: { titleCode } };
|
|
const res = await getPageDetail(params);
|
|
const { code, msg, data } = res.data;
|
|
if (code === 200) {
|
|
if (data && data.length > 0 && data[0] && data[0].length > 0 && data[0][0].detail) {
|
|
this.content = data[0][0].detail.content;
|
|
}
|
|
} else {
|
|
message.error(msg || '查询失败');
|
|
throw msg;
|
|
}
|
|
} catch (error) {
|
|
// throw new Error(`SignIn.vue method getCode: ${error}`);
|
|
// console.log(error);
|
|
}
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|