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
51
52
53
54
55
56
57
58
59
60
| <template>
| <section :class="{'preview': !all, 'all': all}">
| <code class="language-html">
| <slot name="body"></slot>
| </code>
| <div class="show" @click="() => all = !all">{{ msg }}</div>
| </section>
| </template>
|
| <script>
| export default {
| data: function () {
| return {
| all: false
| }
| },
| computed: {
| msg () {
| return !this.all ? 'unfold' : 'fold'
| }
| }
| }
| </script>
|
| <style lang="css" scoped>
| section code.language-html {
| padding: 10px 20px;
| margin: 10px 0px;
| display: block;
| background-color: #333;
| color: #fff;
| overflow-x: auto;
| font-family: Consolas, Monaco, Droid, Sans, Mono, Source, Code, Pro, Menlo, Lucida, Sans, Type, Writer, Ubuntu, Mono;
| border-radius: 5px;
| white-space: pre;
| }
|
| .preview {
| position: relative;
| height: 150px;
| overflow: hidden;
| }
|
| .all{
| position: relative;
| }
|
| .show {
| position: absolute;
| width: 100%;
| text-align: center;
| left: 0;
| bottom: 0;
| line-height: 50px;
| height: 50px;
| cursor: pointer;
| background-color: rgba(255, 255, 255, 0.3);
| color: white;
| }
| </style>
|
|