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

52 lines
1.2 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: '',
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: {}
});