2020-08-13 15:18:26 +08:00
|
|
|
<template>
|
|
|
|
<div
|
|
|
|
class="demo-block"
|
2021-09-04 19:29:28 +08:00
|
|
|
:class="[blockClass, { hover: hovering }]"
|
2020-08-13 15:18:26 +08:00
|
|
|
@mouseenter="hovering = true"
|
|
|
|
@mouseleave="hovering = false"
|
|
|
|
>
|
|
|
|
<div class="source">
|
|
|
|
<slot name="source"></slot>
|
|
|
|
</div>
|
|
|
|
<div ref="meta" class="meta">
|
|
|
|
<div v-if="$slots.default" class="description">
|
|
|
|
<slot></slot>
|
|
|
|
</div>
|
|
|
|
<div class="highlight">
|
|
|
|
<slot name="highlight"></slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
ref="control"
|
|
|
|
class="demo-block-control"
|
|
|
|
:class="{ 'is-fixed': fixedControl }"
|
|
|
|
@click="isExpanded = !isExpanded"
|
|
|
|
>
|
|
|
|
<transition name="arrow-slide">
|
2021-09-04 19:29:28 +08:00
|
|
|
<i :class="[iconClass, { hovering: hovering }]"></i>
|
2020-08-13 15:18:26 +08:00
|
|
|
</transition>
|
|
|
|
<transition name="text-slide">
|
|
|
|
<span v-show="hovering">{{ controlText }}</span>
|
|
|
|
</transition>
|
2021-05-31 14:31:01 +08:00
|
|
|
<div class="control-button-container control-button-container-left">
|
|
|
|
<el-button
|
|
|
|
v-show="isExpanded && hasSetup"
|
|
|
|
size="small"
|
|
|
|
type="text"
|
|
|
|
class="control-button"
|
|
|
|
@click.stop="onSwitchSyntax"
|
|
|
|
>
|
2021-09-04 19:29:28 +08:00
|
|
|
{{
|
|
|
|
showSetup
|
|
|
|
? langConfig['switch-button-option-text']
|
|
|
|
: langConfig['switch-button-setup-text']
|
|
|
|
}}
|
2021-05-31 14:31:01 +08:00
|
|
|
</el-button>
|
|
|
|
</div>
|
2021-01-31 18:42:29 +08:00
|
|
|
<div class="control-button-container">
|
|
|
|
<el-button
|
2021-05-31 14:31:01 +08:00
|
|
|
v-show="isExpanded"
|
2021-01-31 18:42:29 +08:00
|
|
|
ref="copyButton"
|
|
|
|
size="small"
|
|
|
|
type="text"
|
|
|
|
class="control-button copy-button"
|
|
|
|
@click.stop="copy"
|
|
|
|
>
|
|
|
|
{{ langConfig['copy-button-text'] }}
|
|
|
|
</el-button>
|
2021-09-04 19:29:28 +08:00
|
|
|
<el-tooltip
|
|
|
|
effect="dark"
|
|
|
|
:content="langConfig['tooltip-text']"
|
|
|
|
placement="right"
|
|
|
|
>
|
2021-01-31 18:42:29 +08:00
|
|
|
<transition name="text-slide">
|
|
|
|
<el-button
|
2021-05-31 14:31:01 +08:00
|
|
|
v-show="isExpanded"
|
2021-01-31 18:42:29 +08:00
|
|
|
size="small"
|
|
|
|
type="text"
|
2021-09-04 19:29:28 +08:00
|
|
|
class="control-button run-online-button"
|
2021-01-31 18:42:29 +08:00
|
|
|
@click.stop="goCodepen"
|
|
|
|
>
|
|
|
|
{{ langConfig['run-online-button-text'] }}
|
|
|
|
</el-button>
|
|
|
|
</transition>
|
|
|
|
</el-tooltip>
|
|
|
|
</div>
|
2020-08-13 15:18:26 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import { nextTick } from 'vue'
|
2020-09-28 16:09:10 +08:00
|
|
|
import hljs from 'highlight.js'
|
2021-01-31 18:42:29 +08:00
|
|
|
import clipboardCopy from 'clipboard-copy'
|
2020-08-13 15:18:26 +08:00
|
|
|
import compoLang from '../i18n/component.json'
|
2021-09-04 19:29:28 +08:00
|
|
|
import {
|
|
|
|
stripScript,
|
|
|
|
stripStyle,
|
|
|
|
stripTemplate,
|
|
|
|
stripSetup,
|
|
|
|
removeSetup,
|
|
|
|
} from '../util'
|
2020-08-13 15:18:26 +08:00
|
|
|
const version = '1.0.0' // element version
|
2021-09-04 19:29:28 +08:00
|
|
|
const stripTemplateAndRemoveTemplate = (code) => {
|
2021-05-31 14:31:01 +08:00
|
|
|
const result = removeSetup(stripTemplate(code))
|
2020-12-27 23:54:01 +08:00
|
|
|
if (result.indexOf('<template>') === 0) {
|
2021-09-04 19:29:28 +08:00
|
|
|
const html = result.replace(/^<template>/, '').replace(/<\/template>$/, '')
|
|
|
|
return html
|
|
|
|
.replace(/^[\r?\n|\r]/, '')
|
|
|
|
.replace(/[\r?\n|\r]$/, '')
|
|
|
|
.trim()
|
2020-12-27 23:54:01 +08:00
|
|
|
}
|
|
|
|
return result
|
|
|
|
}
|
2021-09-04 19:29:28 +08:00
|
|
|
const sanitizeHTML = (str) => {
|
2021-05-31 14:31:01 +08:00
|
|
|
const temp = document.createElement('div')
|
|
|
|
temp.textContent = str
|
|
|
|
return temp.innerHTML
|
|
|
|
}
|
2020-08-13 15:18:26 +08:00
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
codepen: {
|
|
|
|
script: '',
|
|
|
|
html: '',
|
|
|
|
style: '',
|
|
|
|
},
|
|
|
|
hovering: false,
|
|
|
|
isExpanded: false,
|
|
|
|
fixedControl: false,
|
|
|
|
scrollParent: null,
|
2021-05-31 14:31:01 +08:00
|
|
|
showSetup: false,
|
|
|
|
hasSetup: false,
|
2020-08-13 15:18:26 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
lang() {
|
|
|
|
return this.$route.path.split('/')[1]
|
|
|
|
},
|
|
|
|
|
|
|
|
langConfig() {
|
2021-09-04 19:29:28 +08:00
|
|
|
return compoLang.filter((config) => config.lang === this.lang)[0][
|
|
|
|
'demo-block'
|
|
|
|
]
|
2020-08-13 15:18:26 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
blockClass() {
|
2021-09-04 19:29:28 +08:00
|
|
|
return `demo-${this.lang} demo-${this.$router.currentRoute.value.path
|
|
|
|
.split('/')
|
|
|
|
.pop()}`
|
2020-08-13 15:18:26 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
iconClass() {
|
|
|
|
return this.isExpanded ? 'el-icon-caret-top' : 'el-icon-caret-bottom'
|
|
|
|
},
|
|
|
|
|
|
|
|
controlText() {
|
2021-09-04 19:29:28 +08:00
|
|
|
return this.isExpanded
|
|
|
|
? this.langConfig['hide-text']
|
|
|
|
: this.langConfig['show-text']
|
2020-08-13 15:18:26 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
codeArea() {
|
|
|
|
return this.$el.getElementsByClassName('meta')[0]
|
|
|
|
},
|
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
displayDemoCode() {
|
2021-05-31 14:31:01 +08:00
|
|
|
return this.showSetup ? this.codepen.setup : this.codepen.script
|
2020-08-13 15:18:26 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
isExpanded(val) {
|
2021-05-31 14:31:01 +08:00
|
|
|
this.setCodeAreaHeight()
|
2020-08-13 15:18:26 +08:00
|
|
|
if (!val) {
|
|
|
|
this.fixedControl = false
|
|
|
|
this.$refs.control.style.left = '0'
|
|
|
|
this.removeScrollHandler()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
setTimeout(() => {
|
2021-09-04 19:29:28 +08:00
|
|
|
this.scrollParent = document.querySelector(
|
|
|
|
'.page-component__scroll > .el-scrollbar__wrap'
|
|
|
|
)
|
|
|
|
this.scrollParent &&
|
|
|
|
this.scrollParent.addEventListener('scroll', this.scrollHandler)
|
2020-08-13 15:18:26 +08:00
|
|
|
this.scrollHandler()
|
|
|
|
}, 200)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
created() {
|
|
|
|
const highlight = this.$slots.highlight()
|
|
|
|
if (highlight && highlight[0]) {
|
|
|
|
let code = ''
|
|
|
|
let cur = highlight[0]
|
2021-09-04 19:29:28 +08:00
|
|
|
if (cur.type === 'pre' && cur.children && cur.children[0]) {
|
2020-08-13 15:18:26 +08:00
|
|
|
cur = cur.children[0]
|
2020-12-04 11:55:06 +08:00
|
|
|
if (cur.type === 'code') {
|
|
|
|
code = cur.children
|
2020-08-13 15:18:26 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (code) {
|
2020-12-27 23:54:01 +08:00
|
|
|
this.codepen.html = stripTemplateAndRemoveTemplate(code)
|
2020-08-13 15:18:26 +08:00
|
|
|
this.codepen.script = stripScript(code)
|
|
|
|
this.codepen.style = stripStyle(code)
|
2021-05-31 14:31:01 +08:00
|
|
|
this.codepen.setup = stripSetup(code)
|
|
|
|
if (this.codepen.setup) {
|
|
|
|
this.hasSetup = true
|
|
|
|
}
|
2020-08-13 15:18:26 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
beforeUnmount() {
|
|
|
|
this.removeScrollHandler()
|
|
|
|
},
|
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
mounted() {
|
2021-05-31 14:31:01 +08:00
|
|
|
this.prettyCode()
|
|
|
|
},
|
|
|
|
|
2020-08-13 15:18:26 +08:00
|
|
|
methods: {
|
2021-05-31 14:31:01 +08:00
|
|
|
getCodeAreaHeight() {
|
|
|
|
if (this.$el.getElementsByClassName('description').length > 0) {
|
2021-09-04 19:29:28 +08:00
|
|
|
return (
|
|
|
|
this.$el.getElementsByClassName('description')[0].clientHeight +
|
|
|
|
this.$el.getElementsByClassName('highlight')[0].clientHeight +
|
|
|
|
20
|
|
|
|
)
|
2021-05-31 14:31:01 +08:00
|
|
|
}
|
|
|
|
return this.$el.getElementsByClassName('highlight')[0].clientHeight
|
|
|
|
},
|
2021-09-04 19:29:28 +08:00
|
|
|
setCodeAreaHeight() {
|
|
|
|
this.codeArea.style.height = this.isExpanded
|
|
|
|
? `${this.getCodeAreaHeight() + 1}px`
|
|
|
|
: '0'
|
2021-05-31 14:31:01 +08:00
|
|
|
},
|
2021-09-04 19:29:28 +08:00
|
|
|
prettyCode() {
|
2021-05-31 14:31:01 +08:00
|
|
|
nextTick(() => {
|
|
|
|
const highlight = this.$el.querySelector('.highlight')
|
|
|
|
const hlcode = highlight.querySelector('pre code')
|
2021-06-03 20:37:31 +08:00
|
|
|
const innerScript = `<script>
|
2021-05-31 14:31:01 +08:00
|
|
|
${this.displayDemoCode}
|
|
|
|
${'</sc' + 'ript>'}
|
2021-06-03 20:37:31 +08:00
|
|
|
`
|
2021-09-04 19:29:28 +08:00
|
|
|
const innerStyle =
|
|
|
|
this.codepen.style && this.codepen.style.trim()
|
|
|
|
? `<style>
|
2021-07-15 14:26:17 +08:00
|
|
|
${this.codepen.style}
|
|
|
|
</style>
|
2021-09-04 19:29:28 +08:00
|
|
|
`
|
|
|
|
: ''
|
2021-06-03 20:37:31 +08:00
|
|
|
hlcode.innerHTML = sanitizeHTML(`<template>
|
|
|
|
${this.codepen.html}
|
|
|
|
</template>
|
|
|
|
|
2021-07-15 14:26:17 +08:00
|
|
|
${this.displayDemoCode ? innerScript : ''}${innerStyle}`)
|
2021-05-31 14:31:01 +08:00
|
|
|
|
|
|
|
nextTick(() => {
|
|
|
|
if (this.$el.getElementsByClassName('description').length === 0) {
|
|
|
|
highlight.style.width = '100%'
|
|
|
|
highlight.borderRight = 'none'
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
hljs.highlightBlock(hlcode)
|
|
|
|
} catch (error) {
|
|
|
|
console.log(error)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
2021-09-04 19:29:28 +08:00
|
|
|
onSwitchSyntax() {
|
2021-05-31 14:31:01 +08:00
|
|
|
this.showSetup = !this.showSetup
|
|
|
|
this.prettyCode()
|
|
|
|
this.$nextTick(this.setCodeAreaHeight)
|
|
|
|
},
|
2021-01-31 18:42:29 +08:00
|
|
|
copy() {
|
|
|
|
const res = clipboardCopy(`
|
|
|
|
<template>
|
|
|
|
${this.codepen.html}
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
${' ' + this.codepen.script}
|
|
|
|
\<\/script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
${this.codepen.style}
|
|
|
|
</style>
|
|
|
|
`)
|
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
res
|
|
|
|
.then(() => {
|
|
|
|
this.$message({
|
|
|
|
showClose: true,
|
|
|
|
message: this.langConfig['copy-success'],
|
|
|
|
type: 'success',
|
|
|
|
})
|
2021-01-31 18:42:29 +08:00
|
|
|
})
|
2021-09-04 19:29:28 +08:00
|
|
|
.catch(() => {
|
|
|
|
this.$message({
|
|
|
|
showClose: true,
|
|
|
|
message: this.langConfig['copy-error'],
|
|
|
|
type: 'error',
|
|
|
|
})
|
2021-01-31 18:42:29 +08:00
|
|
|
})
|
|
|
|
},
|
2020-08-13 15:18:26 +08:00
|
|
|
goCodepen() {
|
|
|
|
// since 2.6.2 use code rather than jsfiddle https://blog.codepen.io/documentation/api/prefill/
|
|
|
|
const { script, html, style } = this.codepen
|
2021-09-04 19:29:28 +08:00
|
|
|
const resourcesTpl =
|
|
|
|
'<scr' +
|
|
|
|
'ipt src="//unpkg.com/vue@next"></scr' +
|
|
|
|
'ipt>' +
|
|
|
|
'\n<scr' +
|
|
|
|
`ipt src="//unpkg.com/element-plus/dist/index.full.js"></scr` +
|
|
|
|
'ipt>'
|
2020-08-13 15:18:26 +08:00
|
|
|
let htmlTpl = `${resourcesTpl}\n<div id="app">\n${html.trim()}\n</div>`
|
2021-09-04 19:29:28 +08:00
|
|
|
let cssTpl = `@import url("//unpkg.com/element-plus/dist/index.css");\n${(
|
|
|
|
style || ''
|
|
|
|
).trim()}\n`
|
|
|
|
let jsTpl = script
|
|
|
|
? script
|
|
|
|
.replace(/export default/, 'var Main =')
|
|
|
|
.trim()
|
|
|
|
.replace(
|
|
|
|
/import ({.*}) from 'vue'/g,
|
|
|
|
(s, s1) => `const ${s1} = Vue`
|
|
|
|
)
|
|
|
|
.replace(
|
|
|
|
/import ({.*}) from 'element-plus'/g,
|
|
|
|
(s, s1) => `const ${s1} = ElementPlus`
|
|
|
|
)
|
|
|
|
: 'var Main = {}'
|
|
|
|
jsTpl +=
|
|
|
|
'\n;const app = Vue.createApp(Main);\napp.use(ElementPlus);\napp.mount("#app")'
|
2020-08-13 15:18:26 +08:00
|
|
|
const data = {
|
|
|
|
js: jsTpl,
|
|
|
|
css: cssTpl,
|
|
|
|
html: htmlTpl,
|
|
|
|
}
|
2021-09-04 19:29:28 +08:00
|
|
|
const form =
|
|
|
|
document.getElementById('fiddle-form') || document.createElement('form')
|
2020-08-13 15:18:26 +08:00
|
|
|
while (form.firstChild) {
|
|
|
|
form.removeChild(form.firstChild)
|
|
|
|
}
|
|
|
|
form.method = 'POST'
|
|
|
|
form.action = 'https://codepen.io/pen/define/'
|
|
|
|
form.target = '_blank'
|
|
|
|
form.style.display = 'none'
|
|
|
|
|
|
|
|
const input = document.createElement('input')
|
|
|
|
input.setAttribute('name', 'data')
|
|
|
|
input.setAttribute('type', 'hidden')
|
|
|
|
input.setAttribute('value', JSON.stringify(data))
|
|
|
|
|
|
|
|
form.appendChild(input)
|
|
|
|
document.body.appendChild(form)
|
|
|
|
|
|
|
|
form.submit()
|
2021-02-26 20:37:34 +08:00
|
|
|
document.body.removeChild(form)
|
2020-08-13 15:18:26 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
scrollHandler() {
|
|
|
|
const { top, bottom, left } = this.$refs.meta.getBoundingClientRect()
|
2021-02-01 15:14:07 +08:00
|
|
|
const controlBarHeight = 44
|
2021-09-04 19:29:28 +08:00
|
|
|
this.fixedControl =
|
|
|
|
bottom + controlBarHeight > document.documentElement.clientHeight &&
|
|
|
|
top <= document.documentElement.clientHeight
|
|
|
|
this.$refs.control.style.left = this.fixedControl ? `${left}px` : '0'
|
2020-08-13 15:18:26 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
removeScrollHandler() {
|
2021-09-04 19:29:28 +08:00
|
|
|
this.scrollParent &&
|
|
|
|
this.scrollParent.removeEventListener('scroll', this.scrollHandler)
|
2020-08-13 15:18:26 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
2021-08-26 09:57:56 +08:00
|
|
|
<style lang="scss">
|
2021-09-04 19:29:28 +08:00
|
|
|
.demo-block {
|
|
|
|
border: solid 1px var(--el-border-color-base);
|
|
|
|
border-radius: 3px;
|
|
|
|
transition: 0.2s;
|
|
|
|
|
|
|
|
&.hover {
|
|
|
|
box-shadow: 0 0 8px 0 rgba(232, 237, 250, 0.6),
|
|
|
|
0 2px 4px 0 rgba(232, 237, 250, 0.5);
|
|
|
|
}
|
2020-08-13 15:18:26 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
code {
|
|
|
|
font-family: Menlo, Monaco, Consolas, Courier, monospace;
|
|
|
|
}
|
2020-08-13 15:18:26 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
.demo-button {
|
|
|
|
float: right;
|
|
|
|
}
|
2020-08-13 15:18:26 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
.source {
|
|
|
|
padding: 24px;
|
|
|
|
}
|
2020-08-13 15:18:26 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
.meta {
|
|
|
|
background-color: #fafafa;
|
|
|
|
border-top: solid 1px var(--el-border-color-base);
|
|
|
|
overflow: hidden;
|
|
|
|
height: 0;
|
|
|
|
transition: height 0.2s;
|
|
|
|
}
|
2020-08-13 15:18:26 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
.description {
|
|
|
|
padding: 20px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
border: solid 1px var(--el-border-color-base);
|
|
|
|
border-radius: 3px;
|
|
|
|
font-size: 14px;
|
|
|
|
line-height: 22px;
|
|
|
|
color: var(--el-text-color-regular);
|
|
|
|
word-break: break-word;
|
|
|
|
margin: 10px;
|
|
|
|
background-color: #fff;
|
|
|
|
|
|
|
|
p {
|
|
|
|
margin: 0;
|
|
|
|
line-height: 26px;
|
2020-08-13 15:18:26 +08:00
|
|
|
}
|
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
code {
|
|
|
|
color: #5e6d82;
|
|
|
|
background-color: #e6effb;
|
|
|
|
margin: 0 4px;
|
|
|
|
display: inline-block;
|
|
|
|
padding: 1px 5px;
|
|
|
|
font-size: 12px;
|
2020-08-13 15:18:26 +08:00
|
|
|
border-radius: 3px;
|
2021-09-04 19:29:28 +08:00
|
|
|
height: 18px;
|
|
|
|
line-height: 18px;
|
2020-08-13 15:18:26 +08:00
|
|
|
}
|
2021-09-04 19:29:28 +08:00
|
|
|
}
|
2020-08-13 15:18:26 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
.highlight {
|
|
|
|
pre {
|
|
|
|
margin: 0;
|
|
|
|
}
|
2020-08-13 15:18:26 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
code.hljs {
|
|
|
|
margin: 0;
|
|
|
|
border: none;
|
|
|
|
max-height: none;
|
|
|
|
border-radius: 0;
|
2020-08-13 15:18:26 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
&::before {
|
|
|
|
content: none;
|
2020-08-13 15:18:26 +08:00
|
|
|
}
|
|
|
|
}
|
2021-09-04 19:29:28 +08:00
|
|
|
}
|
2020-08-13 15:18:26 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
.demo-block-control {
|
|
|
|
border-top: solid 1px var(--el-border-color-base);
|
|
|
|
height: 44px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
background-color: #fff;
|
|
|
|
border-bottom-left-radius: 4px;
|
|
|
|
border-bottom-right-radius: 4px;
|
|
|
|
text-align: center;
|
|
|
|
margin-top: -1px;
|
|
|
|
color: #d3dce6;
|
|
|
|
cursor: pointer;
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
&.is-fixed {
|
|
|
|
position: sticky;
|
|
|
|
bottom: 0;
|
|
|
|
}
|
2020-08-13 15:18:26 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
i {
|
|
|
|
font-size: 16px;
|
|
|
|
line-height: 44px;
|
|
|
|
transition: 0.3s;
|
|
|
|
&.hovering {
|
|
|
|
transform: translateX(-40px);
|
2020-08-13 15:18:26 +08:00
|
|
|
}
|
2021-09-04 19:29:28 +08:00
|
|
|
}
|
2020-08-13 15:18:26 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
> span {
|
|
|
|
position: absolute;
|
|
|
|
transform: translateX(-30px);
|
|
|
|
font-size: 14px;
|
|
|
|
line-height: 44px;
|
|
|
|
transition: 0.3s;
|
|
|
|
display: inline-block;
|
|
|
|
}
|
2020-08-13 15:18:26 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
&:hover {
|
|
|
|
color: #409eff;
|
|
|
|
background-color: #f9fafc;
|
|
|
|
}
|
2020-08-13 15:18:26 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
& .text-slide-enter,
|
|
|
|
& .text-slide-leave-active {
|
|
|
|
opacity: 0;
|
|
|
|
transform: translateX(10px);
|
|
|
|
}
|
2020-08-13 15:18:26 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
.control-button-container {
|
|
|
|
line-height: 40px;
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
padding-left: 5px;
|
|
|
|
padding-right: 25px;
|
|
|
|
}
|
2021-01-31 18:42:29 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
.control-button-container-left {
|
|
|
|
left: 0;
|
|
|
|
width: 100px;
|
|
|
|
padding-left: 14px; // 14 + 10 = 24px .hljs code padding left 24
|
|
|
|
}
|
2021-05-31 14:31:01 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
.control-button {
|
|
|
|
font-size: 14px;
|
|
|
|
margin: 0 10px;
|
2020-08-13 15:18:26 +08:00
|
|
|
}
|
|
|
|
}
|
2021-09-04 19:29:28 +08:00
|
|
|
}
|
2020-08-13 15:18:26 +08:00
|
|
|
</style>
|