Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

数据更新之后,View没有变化 #47

Closed
leeight opened this issue Jun 19, 2017 · 2 comments
Closed

数据更新之后,View没有变化 #47

leeight opened this issue Jun 19, 2017 · 2 comments

Comments

@leeight
Copy link
Contributor

leeight commented Jun 19, 2017

  var Block = san.defineComponent({
    template: '<template><div class="x-block"><slot/></div></template>'
  });
  var Foo = san.defineComponent({
    components: {
      'x-block': Block
    },
    template: ''
    + '<template>'
      + '<x-block san-if="f">{{foo}}</x-block>'
      + '<x-block san-else>{{bar}}</x-block>'
    + '</template>',

    initData() {
      return {
        f: false,
        foo: 'foo',
        bar: 'bar'
      }
    }
  });

  var foo = new Foo();
  foo.attach(document.body);

页面打开之后,如果在控制台里面执行 foo.data.set('bar', '123'),页面应该更新,但是没有。

@leeight
Copy link
Contributor Author

leeight commented Jun 19, 2017

同时,如果切换到 3.1.0-beta.6 这个版本,就能复现上次群里说的那个 parent is null 的问题了

@errorrik
Copy link
Contributor

这是两个bug。

  • slot内直接文本节点的更新有问题(parent is null),这是由于文本节点更新的寻址方式优化,不再基于桩元素定位,而是根据parent和sibling定位。当parent为slot时,其el为空不是HTMLElement
  • 修复 Data变更之后,视图没有更新 #43 后,没有对 if 进行处理,所以位于 if 内的 slot 更新失效

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants