优化子节点判断
parent
b04c676288
commit
c6551c9ea3
|
@ -6,7 +6,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// import { isChildren } from '../../utils'
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
list: {
|
list: {
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// import { isChildren } from '../../utils'
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
list: {
|
list: {
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { isChildren } from '../../utils'
|
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
|
@ -48,7 +47,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
handleHide(e) {
|
handleHide(e) {
|
||||||
// if (e && e.target.parentNode != this.$refs.dom_list && this.show) return this.show = false
|
// if (e && e.target.parentNode != this.$refs.dom_list && this.show) return this.show = false
|
||||||
if (e && (e.target == this.$refs.dom_btn || isChildren(this.$refs.dom_btn, e.target))) return
|
if (e && (e.target == this.$refs.dom_btn || this.$refs.dom_btn.contains(e.target))) return
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.show = false
|
this.show = false
|
||||||
}, 50)
|
}, 50)
|
||||||
|
|
|
@ -163,15 +163,6 @@ export const objectDeepMerge = (target, source) => {
|
||||||
Object.assign(target, base)
|
Object.assign(target, base)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断是否父子元素
|
|
||||||
* @param {*} parent
|
|
||||||
* @param {*} children
|
|
||||||
*/
|
|
||||||
export const isChildren = (parent, children) => {
|
|
||||||
return children.parentNode ? children.parentNode === parent ? true : isChildren(parent, children.parentNode) : false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 升级设置
|
* 升级设置
|
||||||
* @param {*} setting
|
* @param {*} setting
|
||||||
|
|
Loading…
Reference in New Issue