Commit c4254cf2 by Joey

fix(@gms/gms-plugin-billexpand): 按钮组悬浮位置错误

parent 2ba90028
<template> <template>
<div class="btngroup-container" :style="btnContainerStyle"> <div ref="btnGroup" class="btngroup-container" :style="btnContainerStyle">
<ButtonGroup class="button-group"> <ButtonGroup class="button-group">
<div v-for="(item, index) in btnGroup" :key="index"> <div v-for="(item, index) in btnGroup" :key="index">
<gms-button :define="item.buttonDefine" :context="context" :billStateDisable="item.billStateDisable"></gms-button> <gms-button :define="item.buttonDefine" :context="context" :billStateDisable="item.billStateDisable"></gms-button>
...@@ -35,7 +35,7 @@ export default { ...@@ -35,7 +35,7 @@ export default {
mounted() { mounted() {
// 判断是否在typesBill组件中 // 判断是否在typesBill组件中
const location = this.define.layout.adsorption === 'bottom' ? 'bottom' : 'top' const location = this.define.layout.adsorption === 'bottom' ? 'bottom' : 'top'
if (document.querySelector('.initHeight')) { if (this.checkParent()) {
if (location === 'top') { if (location === 'top') {
this.btnContainerStyle = { this.btnContainerStyle = {
position: 'fixed', position: 'fixed',
...@@ -55,6 +55,16 @@ export default { ...@@ -55,6 +55,16 @@ export default {
} }
}, },
methods: { methods: {
checkParent() {
let curNode = this.$refs.btnGroup
while (curNode) {
if (!curNode.nodeName) break
if (curNode.nodeName.toLowerCase() == 'body') break
if (curNode.classList.contains('initHeight')) return true
curNode = curNode.parentNode
}
return false
},
getBtnGroup() { getBtnGroup() {
const keys = this.define.config ? this.define.config.btnConfig : [] const keys = this.define.config ? this.define.config.btnConfig : []
this.btnGroup = keys.map((item) => { this.btnGroup = keys.map((item) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment