Home  >  Q&A  >  body text

javascript - weex slide left and right to switch pages?

Each individual page in weex can be jumped using navigator.
How to achieve page jump by swiping left or right? Need to modify the navigator module?

迷茫迷茫2733 days ago557

reply all(2)I'll reply

  • 習慣沉默

    習慣沉默2017-05-19 10:33:17

    Think of 2 methods, both of which require you to have a certain foundation in native development.
    You can first refer to the implementation ideas of https://github.com/hanliuxin5... (we are currently trying to write it in the form of a weex plugin...), Then keep watching

    1 The page is implemented by placing <controller> in <slider><slider>里放置<controller>的方式来实现
    2 需要较大幅度的修改原生代码,将原生Fragment的管理交给FragmentPagerAdapter或者FragmentStatePagerAdapter然后配合ViewPager2 It requires a significant modification of the native code, replacing the native The management of Fragment is handed over to FragmentPagerAdapter or FragmentStatePagerAdapter and then cooperated with ViewPager to implement it

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-19 10:33:17

    This is also a headache for me. You can try the following solutions:
    1. Use navigator.push and pop. The sliding animation depends on the system animation. android>Settings>Developer Options>Excessive Animation. If it needs to be modified on Android, it can be extendedWXNavigatorModule.java,在startActivity的地方加上 overridependingtransition, and several animation effects need to be built in;
    2. The vue-router level is used with transition, but it is really not recommended to use transition on the native level, the effect is too stiff

    In summary, it is more appropriate to extend WXNavigatorModule. There is an OpenUrl extension in the official code, which can be used to appropriately increase capabilities.

    reply
    0
  • Cancelreply