Giter VIP home page Giter VIP logo

Comments (12)

i7soft avatar i7soft commented on August 23, 2024 2

个人猜测:内部组件有些需要跟用户交互的 prop,是有特殊处理,比如经过用户 setData 后,data 的时间戳改变,时间戳改变了,即使值是一样,也需要反馈到 ui 上;但如果 data 提前被 diff 掉了,导致data 的时间戳不变,ui 上相应就不更新了~所以 westore 可以适合很多场景,但某些时候要注意特殊处理

from westore.

dntzhang avatar dntzhang commented on August 23, 2024

小程序有bridge通讯,所以json diff还是必要的。如果在浏览器里json diff 就有点多此一举了

问提2不知道

from westore.

i7soft avatar i7soft commented on August 23, 2024

json diff 之后,官方的表单组件某些属性,比如 value 值,还有 scroll-view 的 x、y 等~如果前后的 data 的值一样,diff 后,那不就不会更新相应组件状态了?

from westore.

dntzhang avatar dntzhang commented on August 23, 2024

为什么会一样?有demo吗看下。 diff是纯数据的diff,和UI表单无关

from westore.

i7soft avatar i7soft commented on August 23, 2024

官方组件里面,有些特殊的 prop,在用户 setData 后,即使 data 前后一样,都是会更新 ui 状态的~demo 一会弄个发上来

from westore.

dntzhang avatar dntzhang commented on August 23, 2024

westore diff是使用自身存下来的 originData diff ,根本用不上 组件或page的data

from westore.

i7soft avatar i7soft commented on August 23, 2024

使用原生 setdata:https://developers.weixin.qq.com/s/25gfSzmq7R3E
使用 westore:https://developers.weixin.qq.com/s/eJgplzmg7V3R

可以看出使用 westore 导致一些行为不是预期

from westore.

dntzhang avatar dntzhang commented on August 23, 2024

👍棒,我看下~~

from westore.

dntzhang avatar dntzhang commented on August 23, 2024

解决元素组件的问题:

<switch bindtap='switchTap' checked="{{value}}"></switch>
  switchTap(){
    this.store.data.value = !this.store.data.value
    this.update()
  },
  aaa:function(){
    this.store.data.value = true
    this.update()
  }

from westore.

dntzhang avatar dntzhang commented on August 23, 2024

棒棒的!我更新到 readme 里。多谢 @i7soft

from westore.

i7soft avatar i7soft commented on August 23, 2024

看了你的解决方案,这样会导致 this.data.value 被改变掉了,小程序里面,原本是用户交互状态不影响 data 的,这个最好也提醒一下

from westore.

dntzhang avatar dntzhang commented on August 23, 2024

恩。

from westore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.