File tree Expand file tree Collapse file tree 1 file changed +2
-26
lines changed
Expand file tree Collapse file tree 1 file changed +2
-26
lines changed Original file line number Diff line number Diff line change 3131
3232<script >
3333import ' ./index.css'
34- import zIndexManager from ' @util/zIndexManager.js '
34+ import { getPopupStyle } from ' @util'
3535
3636import Menu from ' ./menu.vue'
3737import Icon from ' ../icon/index.vue'
@@ -172,31 +172,7 @@ export default {
172172 }
173173 },
174174 getStyle () {
175- const clientRect = this .$el .getBoundingClientRect ()
176- const windowH = window .innerHeight
177- const marginTop = 2
178- const scrollBarWidth = 20
179- const scrollHeight =
180- document .body .scrollWidth > window .innerWidth ? scrollBarWidth : 0
181- const droplistHeight = this .cascaderMenu .clientHeight
182- const defaultTop =
183- clientRect .top + clientRect .height + marginTop + window .pageYOffset
184- const clientHeight = clientRect .height + marginTop
185-
186- const clientY = clientRect .y
187- const compTop = windowH - droplistHeight - scrollHeight
188- const left = clientRect .left + window .pageXOffset
189- const top =
190- droplistHeight + clientHeight + clientY + scrollHeight > windowH
191- ? compTop
192- : defaultTop
193- const zIndex = zIndexManager .next ()
194- return `
195- position: absolute;
196- top: ${ top} px;
197- left: ${ left} px;
198- z-index: ${ zIndex} ;
199- `
175+ return getPopupStyle (this .$el , this .cascaderMenu )
200176 },
201177 resize () {
202178 this .$nextTick (() => {
You can’t perform that action at this time.
0 commit comments