Skip to content

Commit

Permalink
fix: pendingProps取值
Browse files Browse the repository at this point in the history
  • Loading branch information
lareinayanyu committed Dec 10, 2024
1 parent bd86e38 commit d5f8c6e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const getTouchEvent = (
}
)

const pendingProps = (event.target as any)._targetInst.pendingProps || {}
const pendingProps = (event as any)?._targetInst?.pendingProps || {}

const target = extendObject(
{},
Expand Down
12 changes: 9 additions & 3 deletions packages/webpack-plugin/lib/template-compiler/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -2063,16 +2063,22 @@ function processWrapTextReact (el, options, meta) {
if (parentTag !== 'mpx-text' && parentTag !== 'Text' && parentTag !== 'wxs') {
const wrapper = createASTElement('mpx-simple-text')
wrapper.isBuiltIn = true
const dataSetAttrs = []
const inheritAttrs = []
parent.attrsList.forEach(({ name, value }) => {
if (/^data-/.test(name)) {
dataSetAttrs.push({
inheritAttrs.push({
name,
value
})
}
if (/^id$/.test(name)) {
inheritAttrs.push({
name: 'parentId',
value
})
}
})
addAttrs(wrapper, dataSetAttrs)
addAttrs(wrapper, inheritAttrs)
replaceNode(el, wrapper, true)
addChild(wrapper, el)
processBuiltInComponents(wrapper, meta)
Expand Down

0 comments on commit d5f8c6e

Please sign in to comment.