forked from TALL/check-work
29 changed files with 432 additions and 150 deletions
After Width: | Height: | Size: 871 KiB |
After Width: | Height: | Size: 41 KiB |
@ -0,0 +1,65 @@ |
|||
<!-- |
|||
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> |
Loading…
Reference in new issue