39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
export default OakComponent({
|
||
isList: false,
|
||
formData: function ({ features }) {
|
||
return {};
|
||
},
|
||
data: {
|
||
content: '',
|
||
title: '',
|
||
},
|
||
lifetimes: {
|
||
async attached() {
|
||
const data = await this.load('article_html') || '{}';
|
||
const article = typeof data === 'string' ? JSON.parse(data) : data;
|
||
if (article?.title) {
|
||
window.document.title = article.title;
|
||
}
|
||
this.setState({
|
||
content: article?.content,
|
||
title: article?.title,
|
||
});
|
||
},
|
||
detached() {
|
||
this.save('article_html', '{}');
|
||
},
|
||
},
|
||
properties: {
|
||
tocClosed: false,
|
||
tocFixed: true,
|
||
tocPosition: 'none',
|
||
highlightBgColor: 'none',
|
||
headerTop: 0, //页面中吸顶部分高度
|
||
className: '',
|
||
scrollId: '', // 滚动条所在容器id,不传默认body
|
||
tocWidth: undefined,
|
||
tocHeight: undefined,
|
||
},
|
||
methods: {},
|
||
});
|