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

从null或undefined变成[]的时候,不会被更新 #40

Closed
z-ZYS-s opened this issue Jun 25, 2015 · 1 comment
Closed

从null或undefined变成[]的时候,不会被更新 #40

z-ZYS-s opened this issue Jun 25, 2015 · 1 comment
Milestone

Comments

@z-ZYS-s
Copy link
Contributor

z-ZYS-s commented Jun 25, 2015

Demo如下:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>

<script src="http://rawgit.com/sindresorhus/multiline/master/browser.js"></script>
<script src="http://rawgit.com/regularjs/regular/master/dist/regular.min.js"></script>
<script>
var ListView = Regular.extend({
  name: 'listView',
  config: function() {
    var self = this;
    setTimeout(function() {
      self.$update('list1', []);
      self.$update('list2', [{name: 1}]);
    }, 200);
  },
  template: multiline(function(){/*
    {#list list as item}
      <div>{item.name}</div>
    {/list}
  */})
});

var App = Regular.extend({
  config: function() {
    // this.data.children1 = undefined;
    // this.data.children2 = undefined;
  },
  template: multiline(function(){/*
    <listView list1={children1} list2={children2} />
    {#if children1}Length: {children1.length}{/if}
    {#if children2}Length: {children2.length}{/if}
  */})
});

(new App()).$inject('body');

</script>
</body>
</html>
@leeluolee
Copy link
Member

it("watch list [undefined - > [], [] -> undefined]", function(done){
testcase

@leeluolee leeluolee added this to the v0.4.0 milestone Jul 12, 2015
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