52 lines
1.3 KiB
JavaScript
52 lines
1.3 KiB
JavaScript
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: {}
|
||
});
|