oak-general-business/es/components/article/detail/index.js

52 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { DATA_SUBSCRIBER_KEYS } from "../../../config/constants";
export default OakComponent({
entity: 'article',
isList: false,
projection: {
id: 1,
name: 1,
content: 1,
articleMenu: {
id: 1,
name: 1,
isArticle: 1,
},
},
formData: function ({ data: article }) {
return {
content: article?.content,
name: article?.name,
};
},
properties: {
tocClosed: false,
tocFixed: true,
tocPosition: 'none',
highlightBgColor: 'none',
headerTop: 0, //页面中吸顶部分高度
className: '',
scrollId: '', // 滚动条所在容器id不传默认body
tocWidth: undefined,
tocHeight: undefined,
showtitle: false, //大纲顶层显示文章名称
activeColor: undefined,
},
data: {
unsub: undefined,
},
lifetimes: {
async ready() {
const { oakId } = this.props;
const unsub = await this.subDataEvents([`${DATA_SUBSCRIBER_KEYS.articleUpdate}-${oakId}`]);
this.setState({
unsub,
});
},
detached() {
const { unsub } = this.state;
unsub && unsub();
}
},
methods: {}
});