vuepress-theme-uniapp-official 1.4.23 → 1.4.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -34,66 +34,71 @@ export default {
|
|
|
34
34
|
},
|
|
35
35
|
createdDom(h,node){
|
|
36
36
|
let headerDom = []
|
|
37
|
-
node.forEach((v,index)=>{
|
|
38
|
-
headerDom.push(h('p',
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
node.forEach((v, index) => {
|
|
38
|
+
headerDom.push(h('p', {
|
|
39
|
+
class: `pages-tabs-header-text ${this.activeIndex === index ? 'pages-tabs--active' : ''}`, on: {
|
|
40
|
+
click: (e) => {
|
|
41
|
+
this.onClick(index)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}, v.title),)
|
|
41
45
|
})
|
|
42
|
-
return this.renderDom(h,h('div',{class:'page-tabs'},[
|
|
43
|
-
h('div',{class:'pages-tabs-header'},headerDom),
|
|
44
|
-
h('div',{class:'page-snippet-code',key:this.activeIndex},[node[this.activeIndex].node]),
|
|
46
|
+
return this.renderDom(h, h('div', { class: 'page-tabs' }, [
|
|
47
|
+
h('div', { class: 'pages-tabs-header' }, headerDom),
|
|
48
|
+
h('div', { class: 'page-snippet-code', key: this.activeIndex }, [node[this.activeIndex].node]),
|
|
45
49
|
]))
|
|
46
50
|
},
|
|
47
51
|
renderDom(h,node){
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
return h('div', { class: 'page-runtime' }, [
|
|
53
|
+
h('div', { class: 'page-snippet' , style: { height: this.src ? '667px' : 'auto' }}, [node]),
|
|
54
|
+
h('div', { class: 'code-content', style: { display: this.src ? 'block' : 'none' } }, [
|
|
55
|
+
h('iframe', {
|
|
56
|
+
class: 'code-iframe',
|
|
57
|
+
attrs: {
|
|
58
|
+
src: this.src,
|
|
59
|
+
frameborder: '0',
|
|
60
|
+
allow: 'geolocation https://hellouniappx.dcloud.net.cn',
|
|
61
|
+
},
|
|
62
|
+
ref: 'codeIframe',
|
|
63
|
+
}),
|
|
64
|
+
]),
|
|
65
|
+
])
|
|
61
66
|
}
|
|
62
67
|
},
|
|
63
68
|
render(h){
|
|
64
69
|
const columns = this.$slots.default || []
|
|
65
70
|
let boxObj = []
|
|
66
71
|
let realDom = []
|
|
67
|
-
columns.forEach((v,i)=>{
|
|
68
|
-
if(v.tag && v.children){
|
|
72
|
+
columns.forEach((v, i) => {
|
|
73
|
+
if (v.tag && v.children) {
|
|
69
74
|
realDom.push(v)
|
|
70
75
|
}
|
|
71
76
|
})
|
|
72
|
-
realDom.forEach((vnode,index)=>{
|
|
77
|
+
realDom.forEach((vnode, index) => {
|
|
73
78
|
let code = vnode.children[0]
|
|
74
|
-
if(vnode.tag === 'div' && code.tag === 'pre'){
|
|
79
|
+
if (vnode.tag === 'div' && code.tag === 'pre') {
|
|
75
80
|
let i = index - 1
|
|
76
|
-
if(i >= 0){
|
|
81
|
+
if (i >= 0) {
|
|
77
82
|
let textDom = realDom[i]
|
|
78
|
-
if(textDom.tag === 'blockquote'){
|
|
83
|
+
if (textDom.tag === 'blockquote') {
|
|
79
84
|
let text = textDom.children[0]
|
|
80
85
|
let p = text.children[0]
|
|
81
86
|
boxObj.push({
|
|
82
|
-
title:p.text,
|
|
83
|
-
node:vnode
|
|
87
|
+
title: p.text ? p.text : 'title',
|
|
88
|
+
node: vnode
|
|
84
89
|
})
|
|
85
90
|
}
|
|
86
91
|
|
|
87
92
|
}
|
|
88
93
|
}
|
|
89
94
|
})
|
|
90
|
-
if(boxObj.length > 0){
|
|
91
|
-
return h('div',null,[this.createdDom(h,boxObj)])
|
|
92
|
-
}else{
|
|
93
|
-
if(this.src){
|
|
94
|
-
return this.renderDom(h,this.$slots.default)
|
|
95
|
-
}else{
|
|
96
|
-
return h('div',null,this.$slots.default)
|
|
95
|
+
if (boxObj.length > 0) {
|
|
96
|
+
return h('div', null, [this.createdDom(h, boxObj)])
|
|
97
|
+
} else {
|
|
98
|
+
if (this.src) {
|
|
99
|
+
return this.renderDom(h, this.$slots.default)
|
|
100
|
+
} else {
|
|
101
|
+
return h('div', null, this.$slots.default)
|
|
97
102
|
}
|
|
98
103
|
}
|
|
99
104
|
}
|
|
@@ -123,17 +128,12 @@ export default {
|
|
|
123
128
|
display: flex;
|
|
124
129
|
height: 44px;
|
|
125
130
|
background-color: #222;
|
|
131
|
+
align-items: center;
|
|
126
132
|
}
|
|
127
133
|
.pages-tabs-header-text {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
margin: 5px;
|
|
132
|
-
margin-bottom: 0px;
|
|
133
|
-
border-top-left-radius: 5px;
|
|
134
|
-
border-top-right-radius: 5px;
|
|
135
|
-
padding: 0 45px;
|
|
136
|
-
text-align: center;
|
|
134
|
+
margin: 0 0 0 8px;
|
|
135
|
+
padding: 4px 8px;
|
|
136
|
+
border-radius: 5px;
|
|
137
137
|
font-size: 16px;
|
|
138
138
|
color: #eee;
|
|
139
139
|
background:transparent;
|
|
@@ -144,11 +144,14 @@ export default {
|
|
|
144
144
|
-khtml-user-select:none; /*早期浏览器*/
|
|
145
145
|
user-select:none;
|
|
146
146
|
}
|
|
147
|
+
.pages-tabs-header-text:hover {
|
|
148
|
+
background: #454545;
|
|
149
|
+
}
|
|
147
150
|
.pages-tabs--active {
|
|
148
151
|
// background:#282c34;
|
|
149
|
-
background-color: #
|
|
152
|
+
background-color: #3b3b3b;
|
|
150
153
|
color: #fff;
|
|
151
|
-
font-weight: bold;
|
|
154
|
+
// font-weight: bold;
|
|
152
155
|
}
|
|
153
156
|
|
|
154
157
|
.page-snippet div[class*="language-"]{
|