File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " vuepress-plugin-demo-block-vue3" ,
3- "version" : " 1.0.0 " ,
3+ "version" : " 1.0.2 " ,
44 "description" : " Vuepress2 plugin for demo block support vue3." ,
55 "main" : " src/index.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ export default {
109109 this .$el .getElementsByClassName (" code-content" )[0 ].clientHeight +
110110 30
111111 );
112- }
112+ }
113113 return this .$el .getElementsByClassName (" code-content" )[0 ].clientHeight + 20 ;
114114 }
115115 },
@@ -129,11 +129,15 @@ export default {
129129 }, 1500 );
130130 },
131131 scrollHandler () {
132- const { top , bottom , left } = this .$refs .meta .getBoundingClientRect ();
133- this .fixedControl =
134- bottom > document .documentElement .clientHeight &&
135- top + 44 <= document .documentElement .clientHeight ;
136- this .$refs .control .style .left = this .fixedControl ? ` ${ left + 1 } px` : " 0" ;
132+ this .$nextTick (() => {
133+ if (this .$refs && this .$refs .meta && this .$refs .meta .getBoundingClientRect ) {
134+ const { top , bottom , left } = this .$refs .meta .getBoundingClientRect ();
135+ this .fixedControl =
136+ bottom > document .documentElement .clientHeight &&
137+ top + 44 <= document .documentElement .clientHeight ;
138+ this .$refs .control .style .left = this .fixedControl ? ` ${ left + 1 } px` : " 0" ;
139+ }
140+ })
137141 },
138142 removeScrollHandler () {
139143 this .scrollParent &&
@@ -245,7 +249,7 @@ export default {
245249 -webkit-font-smoothing : antialiased ;
246250}
247251.demo-block .demo-block-control .caret-top ::before {
248- margin-top : 2 px ;
252+ margin-top : 6 px ;
249253 content : " " ;
250254 position : absolute ;
251255 right : 50% ;
@@ -256,7 +260,7 @@ export default {
256260 border-left : 6px solid transparent ;
257261}
258262.demo-block .demo-block-control .caret-bottom ::before {
259- margin-top : 2 px ;
263+ margin-top : 6 px ;
260264 content : " " ;
261265 position : absolute ;
262266 right : 50% ;
You can’t perform that action at this time.
0 commit comments