Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

feat(wechat): view 支持 catchTouchMove 事件 #1105

Merged
merged 8 commits into from
Jul 9, 2020
Merged

Conversation

noyobo
Copy link
Contributor

@noyobo noyobo commented Jun 19, 2020

  • 验证 catch 事件给模板带来的副作用

@vercel
Copy link

vercel bot commented Jun 19, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/remaxjs/remax/lfxbugnt3
✅ Preview: https://remax-git-catch-events.remaxjs.vercel.app

@noyobo
Copy link
Contributor Author

noyobo commented Jun 19, 2020

坑呀。 只要声明了 catch 的事件就乱套了。。。

@noyobo
Copy link
Contributor Author

noyobo commented Jun 19, 2020

即便现在的方式,通过 JSX 分析的, 依然会有问题。 base.xml 里生成的都会带这个字段的模版。

考虑以下结构

remax: 2.5.5

<View id="parent" style="padding: 100px" onTouchMove="P-A">
   <View wechat-catchtouchmove="C-A" />
</View>

实际作用的模版是

<View id="parent"  style="padding: 100px" bindtouchmove="P-A" catchtouchmove="{{undefined}}">
   <View catchtouchmove="C-A" />
</View>

导致 P-A 函数也无法触发了。 因为节点本身也设置了 catchtouchmove

@Darmody
Copy link
Contributor

Darmody commented Jun 23, 2020

试试用 if else 渲染不同的模板

并对模板进行条件渲染,含 catchTouchMove 属性的 node 节点单独渲染,避免由于空属性导致其他 View 出现副作用。
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 30, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 6312f78:

Sandbox Source
remaxjs/examples: one Configuration

@noyobo noyobo changed the title feat(wechat): view 增加相关 catch 事件 props feat(wechat): view 支持 catchTouchMove 事件 Jun 30, 2020
@noyobo noyobo requested review from Darmody and yesmeck July 6, 2020 01:47
@codecov
Copy link

codecov bot commented Jul 8, 2020

Codecov Report

Merging #1105 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1105   +/-   ##
=======================================
  Coverage   95.27%   95.27%           
=======================================
  Files         350      350           
  Lines        3682     3682           
  Branches      515      515           
=======================================
  Hits         3508     3508           
  Misses        172      172           
  Partials        2        2           
Impacted Files Coverage Δ
...kages/remax-wechat/src/hostComponents/View/node.ts 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5ed265f...6312f78. Read the comment docs.

@noyobo noyobo requested a review from Darmody July 8, 2020 02:18
@Darmody
Copy link
Contributor

Darmody commented Jul 9, 2020

LGTM

@Darmody Darmody merged commit 901cc2d into master Jul 9, 2020
@Darmody Darmody deleted the catch-events branch July 9, 2020 01:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants