forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDocCode.vue
More file actions
50 lines (40 loc) · 797 Bytes
/
DocCode.vue
File metadata and controls
50 lines (40 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<template lang="pug">
.doc-code-container
code-prism(:lang="lang" :code="code" :style="style")
.doc-code-container__copy.absolute
copy-button(:text="code")
</template>
<script>
import { computed } from 'vue'
import CodePrism from './CodePrism.js'
import CopyButton from './CopyButton'
export default {
name: 'DocCode',
components: {
CodePrism,
CopyButton
},
props: {
code: String,
maxHeight: String,
lang: {
type: String,
default: 'js'
}
},
setup (props) {
const style = computed(() => (
props.maxHeight !== void 0
? { overflow: 'auto', maxHeight: props.maxHeight }
: null
))
return { style }
}
}
</script>
<style lang="sass">
.doc-code-container
&__copy
top: 8px
right: 16px
</style>