naive-ui/demo/utils/ComponentDemo.vue

79 lines
1.5 KiB
Vue
Raw Normal View History

2019-09-17 19:24:39 +08:00
<template>
<div
class="n-code-box"
:class="{
[`n-${synthesizedTheme}-theme`]: synthesizedTheme
}"
2019-09-24 16:59:07 +08:00
n-dark-theme-background-color-hint="transparent"
2019-09-20 00:22:55 +08:00
n-light-theme-background-color-hint="white"
2019-09-17 19:24:39 +08:00
>
<div class="n-code-box__title">
<slot name="title" />
2019-09-21 17:03:37 +08:00
<n-tooltip
2019-09-28 13:47:54 +08:00
:delay="300"
2019-09-21 17:03:37 +08:00
:placement="'top'"
:arrow="true"
>
<template v-slot:activator>
<n-button
size="tiny"
ghost
icon="md-code"
circle
@click="toggleCodeDisplay"
/>
</template>
Show Code
</n-tooltip>
2019-09-17 19:24:39 +08:00
</div>
<div class="n-code-box__content markdown">
2019-09-17 19:24:39 +08:00
<slot name="content" />
</div>
<div
class="n-code-box__view"
>
<slot name="demo" />
</div>
<div
v-if="showCode"
class="n-code-box__code"
>
2019-09-27 15:56:33 +08:00
<n-scrollbar>
<slot name="code" />
</n-scrollbar>
2019-09-17 19:24:39 +08:00
</div>
</div>
</template>
<script>
2019-09-23 15:04:57 +08:00
import withapp from '../../packages/mixins/withapp'
import themeable from '../../packages/mixins/themeable'
2019-09-17 19:24:39 +08:00
export default {
mixins: [withapp, themeable],
data () {
return {
2019-09-20 00:22:55 +08:00
showCode: false,
lightThemeCSSRef: null,
defaultThemeCSSRef: null
2019-09-17 19:24:39 +08:00
}
},
2019-09-20 00:22:55 +08:00
watch: {
synthesizedTheme (value) {
}
},
mounted () {
// document.querySelector('')
},
2019-09-17 19:24:39 +08:00
methods: {
2019-09-20 00:22:55 +08:00
switchHighlightStyle () {
},
toggleCodeDisplay () {
2019-09-17 19:24:39 +08:00
this.showCode = !this.showCode
}
}
}
</script>