提交 9fbefe3b 编写于 作者: X xzs02

fix: 解决选择节点时不包含当前页面节点的问题

上级 3715b37f
......@@ -71,19 +71,23 @@ function getNodeInfo (el, fields) {
function getNodesInfo (pageVm, component, selector, single, fields) {
const $el = pageVm.$el
if (single) {
const node = $el.querySelector(selector)
const node = $el.matches(selector) ? $el : $el.querySelector(selector)
if (node) {
return getNodeInfo(node, fields)
}
return null
} else {
let infos = []
const nodeList = $el.querySelectorAll(selector)
if (nodeList && nodeList.length) {
return ([]).map.call(nodeList, node => {
infos = ([]).map.call(nodeList, node => {
return getNodeInfo(node, fields)
})
}
return []
if ($el.matches(selector)) {
infos.unshift($el)
}
return infos
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册