优化子节点判断

pull/225/head
lyswhut 2020-03-16 12:51:14 +08:00
parent b04c676288
commit c6551c9ea3
4 changed files with 3 additions and 13 deletions

View File

@ -6,7 +6,7 @@
</template>
<script>
// import { isChildren } from '../../utils'
export default {
props: {
list: {

View File

@ -10,7 +10,7 @@
</template>
<script>
// import { isChildren } from '../../utils'
export default {
props: {
list: {

View File

@ -13,7 +13,6 @@
</template>
<script>
import { isChildren } from '../../utils'
import { mapGetters } from 'vuex'
export default {
props: {
@ -48,7 +47,7 @@ export default {
methods: {
handleHide(e) {
// 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(() => {
this.show = false
}, 50)

View File

@ -163,15 +163,6 @@ export const objectDeepMerge = (target, source) => {
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