Skip to content

Commit

Permalink
fix(h5): 让 h5 支持 dataset,fix #9798
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen-jj committed Jul 16, 2021
1 parent 8e93e44 commit 485efc3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 3 additions & 0 deletions packages/taro-components/h5/react/utils/reactify-wc.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ function updateProp (ctx, comp, propKey, prevProps, props) {
}
return
}
if (/^data-.+/.test(propKey)) {
dom.setAttribute(propKey, val)
}
if (comp === SCROLL_VIEW) {
if (propKey === 'scrollTop') {
dom.mpScrollTop = val
Expand Down
6 changes: 2 additions & 4 deletions packages/taro-router/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ function hidePage (page: PageInstance | null) {
function showPage (page: PageInstance | null, pageConfig: Route | undefined) {
if (page != null) {
page.onShow!()
const pageEl = document.getElementById(page.path!)
let pageEl = document.getElementById(page.path!)
if (pageEl) {
pageEl.style.display = 'block'
} else {
page.onLoad(qs())
pageEl = document.getElementById(page.path!)
pageOnReady(pageEl, page, false)
}
bindPageScroll(page, pageConfig || {})
Expand Down Expand Up @@ -81,9 +82,6 @@ function loadPage (page: PageInstance | null, pageConfig: Route | undefined) {
pageEl.style.display = 'block'
} else {
page.onLoad(qs())
requestAnimationFrame(() => {
page.onReady!()
})
pageEl = document.getElementById(page.path!)
pageOnReady(pageEl, page)
}
Expand Down

0 comments on commit 485efc3

Please sign in to comment.