mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-05 04:37:47 +08:00
chore: update doc template (#2142)
This commit is contained in:
parent
da622e10d1
commit
0cac0bda38
@ -77,7 +77,8 @@ const version = '1.0.0' // element version
|
|||||||
const stripTemplateAndRemoveTemplate = code => {
|
const stripTemplateAndRemoveTemplate = code => {
|
||||||
const result = removeSetup(stripTemplate(code))
|
const result = removeSetup(stripTemplate(code))
|
||||||
if (result.indexOf('<template>') === 0) {
|
if (result.indexOf('<template>') === 0) {
|
||||||
return result.replace(/^<template>/, '').replace(/<\/template>$/,'')
|
const html = result.replace(/^<template>/, '').replace(/<\/template>$/,'')
|
||||||
|
return html.replace(/^[\r?\n|\r]/, '').replace(/[\r?\n|\r]$/, '').trim()
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
@ -196,12 +197,15 @@ export default {
|
|||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
const highlight = this.$el.querySelector('.highlight')
|
const highlight = this.$el.querySelector('.highlight')
|
||||||
const hlcode = highlight.querySelector('pre code')
|
const hlcode = highlight.querySelector('pre code')
|
||||||
hlcode.innerHTML = sanitizeHTML(`<template>${this.codepen.html}</template>
|
const innerScript = `<script>
|
||||||
|
|
||||||
<script>
|
|
||||||
${this.displayDemoCode}
|
${this.displayDemoCode}
|
||||||
${'</sc' + 'ript>'}
|
${'</sc' + 'ript>'}
|
||||||
`)
|
`
|
||||||
|
hlcode.innerHTML = sanitizeHTML(`<template>
|
||||||
|
${this.codepen.html}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
${this.displayDemoCode ? innerScript : ''}`)
|
||||||
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
if (this.$el.getElementsByClassName('description').length === 0) {
|
if (this.$el.getElementsByClassName('description').length === 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user