const __templateJs = require("./templates.js");
const __mergePageOptions = require("../../util/mergePageOptions.js");
const htmlSnip = `
Title
Life is like a box of
chocolates.
`;
const nodeSnip = `Page({
data: {
nodes: [{
name: 'div',
attrs: {
class: 'div_class',
style: 'line-height: 60rpx; color: #1AAD19;'
},
children: [{
type: 'text',
text: 'You never know what you're gonna get.'
}]
}]
}
})
`;
Page(__mergePageOptions({
onShareAppMessage() {
return {
title: 'rich-text',
path: 'page/component/pages/rich-text/rich-text'
};
},
onLoad() {
setTimeout(() => {
this.removeSkeleton?.();
}, 1000);
},
data: {
htmlSnip,
nodeSnip,
renderedByHtml: false,
renderedByNode: false,
nodes: [{
name: 'div',
attrs: {
class: 'div_class',
style: 'line-height: 60rpx; color: red;'
},
children: [{
type: 'text',
text: 'You never know what you\'re gonna get.'
}]
}],
rt1: `
h1标题
h2标题
h3标题
h4标题
h5标题
h6标题
斜体
这是一个段落p标签
引号标签
span标签
strong标签
sub标签
sup标签
`
},
renderHtml() {
this.setData({
renderedByHtml: true
});
},
renderNode() {
this.setData({
renderedByNode: true
});
},
enterCode(e) {
console.log(e.detail.value);
this.setData({
htmlSnip: e.detail.value
});
}
}, __templateJs));