From 04f9ef1a19e28a04ce42bebeb8de55add5124267 Mon Sep 17 00:00:00 2001 From: liyang <1711467488@qq.com> Date: Wed, 18 Jul 2018 00:14:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: e701aacf23cc8788415897a957d90d50f02ec915 [formerly e701aacf23cc8788415897a957d90d50f02ec915 [formerly e701aacf23cc8788415897a957d90d50f02ec915 [formerly e701aacf23cc8788415897a957d90d50f02ec915 [formerly 05ecd4d691f0399f0a45841f87f28ab8fa209ad8 [formerly dc8b3924307f1834519d6d2adbe0b3eab2f0b9f9]]]]] Former-commit-id: 5057dacc82842dadce57d2889423e7991ed10641 Former-commit-id: 1ecc5c9c9f329600c1779a920a5b6e7d50e3db4d Former-commit-id: 920ca6317275138866e8da9dc63e5f5b106f3352 [formerly f407e4fe88064c4ade2544991034394f97c9a5ab] Former-commit-id: e8dbe199693eb22b90241c1e36039ecf56cc9817 Former-commit-id: 41d4626eb9a8d36442f23d1ae032cdccefa52ba0 Former-commit-id: 962ea8fe670039e21701d2ba9757387b6cb244d2 Former-commit-id: df96608847d3282c1fa9d18a29f7c1709c50d0cc Former-commit-id: 8661b8b0172ff0b0cd7b6880a7953cfc6942d258 --- docs/zh/components/highlight.md | 2 +- docs/zh/guide/change-log.md | 1 + src/components/core/d2-highlight/index.vue | 4 ++-- src/pages/demo/components/editor-quill/index.vue | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/zh/components/highlight.md b/docs/zh/components/highlight.md index 3ccaa892..f8830d31 100644 --- a/docs/zh/components/highlight.md +++ b/docs/zh/components/highlight.md @@ -5,7 +5,7 @@ | 参数名 | 介绍 | 必选 | 值类型 | 可选值 | 默认值 | | --- | --- | --- | --- | --- | --- | | code | 代码字符串 | 非 | String | | console.log('you lost code prop') | -| format | 是否格式化 HTML | 非 | Boolean | | false | +| format-html | 是否格式化 HTML | 非 | Boolean | | false | ::: tip format 建议只在内容为 HTML 的时候打开,如果内容不是 HTML,设置为 true 会有负面效果 diff --git a/docs/zh/guide/change-log.md b/docs/zh/guide/change-log.md index a9b8d96b..9912f0ad 100644 --- a/docs/zh/guide/change-log.md +++ b/docs/zh/guide/change-log.md @@ -9,6 +9,7 @@ * [ 修改 ] bug fixed [#41](https://github.com/d2-projects/d2-admin/issues/41) * [ 修改 ] 侧边栏和顶栏菜单数据控制转移到 vuex 集中管理 * [ 修改 ] 页面最小宽度设置 +* [ 新增 ] d2-highlight 组件新增 format-html 参数 ## v1.1.4 diff --git a/src/components/core/d2-highlight/index.vue b/src/components/core/d2-highlight/index.vue index 47be614a..f823a3cb 100644 --- a/src/components/core/d2-highlight/index.vue +++ b/src/components/core/d2-highlight/index.vue @@ -15,7 +15,7 @@ export default { required: false, default: `console.log('you lost code prop')` }, - format: { + formatHtml: { type: Boolean, required: false, default: false @@ -36,7 +36,7 @@ export default { }, methods: { highlight () { - const code = this.format ? htmlFormat(this.code) : this.code + const code = this.formatHtml ? htmlFormat(this.code) : this.code this.highlightHTML = highlight.highlightAuto(code).value } } diff --git a/src/pages/demo/components/editor-quill/index.vue b/src/pages/demo/components/editor-quill/index.vue index 51310c2f..fe4a1cc0 100644 --- a/src/pages/demo/components/editor-quill/index.vue +++ b/src/pages/demo/components/editor-quill/index.vue @@ -8,7 +8,7 @@ @selection-change="selectionChangeHandler" @editor-change="editorChangeHandler"/> - +