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
This commit is contained in:
liyang
2018-07-18 00:14:31 +08:00
parent a780f48f58
commit 04f9ef1a19
4 changed files with 5 additions and 4 deletions

View File

@@ -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 会有负面效果

View File

@@ -9,6 +9,7 @@
* [ 修改 ] bug fixed [#41](https://github.com/d2-projects/d2-admin/issues/41)
* [ 修改 ] 侧边栏和顶栏菜单数据控制转移到 vuex 集中管理
* [ 修改 ] 页面最小宽度设置
* [ 新增 ] d2-highlight 组件新增 format-html 参数
## v1.1.4

View File

@@ -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
}
}

View File

@@ -8,7 +8,7 @@
@selection-change="selectionChangeHandler"
@editor-change="editorChangeHandler"/>
<el-card shadow="never" class="d2-mt">
<d2-highlight :code="value" format/>
<d2-highlight :code="value" format-html/>
</el-card>
</d2-container>
</template>