添加 marked 自定义属性
vue 组件添加 `markedOptions` 属性,用户可自定义 marked 配置。
This commit is contained in:
parent
825a6ff713
commit
3520ecee40
@ -54,6 +54,12 @@ export default {
|
|||||||
exportFileName: { // 默认导出文件名称
|
exportFileName: { // 默认导出文件名称
|
||||||
type: String,
|
type: String,
|
||||||
default: '未命名文件'
|
default: '未命名文件'
|
||||||
|
},
|
||||||
|
markedOptions: {
|
||||||
|
type: Object,
|
||||||
|
default () {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -449,7 +455,8 @@ export default {
|
|||||||
clearTimeout(this.timeoutId);
|
clearTimeout(this.timeoutId);
|
||||||
this.timeoutId = setTimeout(() => {
|
this.timeoutId = setTimeout(() => {
|
||||||
this.html = marked(this.value, {
|
this.html = marked(this.value, {
|
||||||
sanitize: false
|
sanitize: false,
|
||||||
|
...this.markedOptions
|
||||||
});
|
});
|
||||||
}, 30)
|
}, 30)
|
||||||
this.indexLenth = this.value.split('\n').length;
|
this.indexLenth = this.value.split('\n').length;
|
||||||
|
Loading…
Reference in New Issue
Block a user