提交 4d8c89d3 编写于 作者: fxy060608's avatar fxy060608

fix(v3): ignore comment element (requestComponentInfo)

上级 548a67ce
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -84,14 +84,15 @@ function getNodeInfo (el, fields) { ...@@ -84,14 +84,15 @@ function getNodeInfo (el, fields) {
function getNodesInfo (pageVm, component, selector, single, fields) { function getNodesInfo (pageVm, component, selector, single, fields) {
const $el = findElm(component, pageVm) const $el = findElm(component, pageVm)
if (!$el || ($el && $el.nodeType === 8)) { // Comment
return single ? null : []
}
if (single) { if (single) {
const node = $el && ($el.matches(selector) ? $el : $el.querySelector(selector)) const node = $el.matches(selector) ? $el : $el.querySelector(selector)
if (node) { if (node) {
return getNodeInfo(node, fields) return getNodeInfo(node, fields)
} }
return null return null
} else if (!$el) {
return []
} else { } else {
let infos = [] let infos = []
const nodeList = $el.querySelectorAll(selector) const nodeList = $el.querySelectorAll(selector)
......
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
export default function initVue (Vue) { export default function initVue (Vue) {
Vue.config.errorHandler = function (err) { Vue.config.errorHandler = function (err) {
const app = getApp() const app = typeof getApp === 'function' && getApp()
if (app && hasLifecycleHook(app.$options, 'onError')) { if (app && hasLifecycleHook(app.$options, 'onError')) {
app.__call_hook('onError', err) app.__call_hook('onError', err)
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册