小编Dan*_*nau的帖子

如何更新聚合物模型中的hidden $ =属性?

此jsbin中,当您单击“显示更多”按钮时,应该能够看到呈现的“ 4”。控制台会将更改记录到my-element的模型中,但是DOM不会更新。我做错了什么?

<!DOCTYPE html>
<html>
<head>
  <title>polymer</title>
  <script src="https://rawgit.com/webcomponents/webcomponentsjs/master/webcomponents-lite.js"></script>
  <link rel="import" href="https://rawgit.com/Polymer/polymer/master/polymer.html">
</head>
<body>

<dom-module id="my-element">
  <template>
    <button on-click="_dosomething">show more</button>
    <template is="dom-repeat" items="{{myItems}}" >
      <div hidden$="{{_isItemHidden(item, shownItems)}}">{{item}}</div>
    </template>
  </template>
</dom-module>

<script>
  HTMLImports.whenReady(function() {
    Polymer({
     is: 'my-element',
     ready: function() {
      this.myItems = [1,2,3,4,5];
      this.shownItems = [1,2,3]
     }, 
      _dosomething: function(){
        console.log(this.shownItems);
        this.push('shownItems', 4);
        console.log(this.shownItems);
      },
      _isItemHidden: function(item, shownItems) {
        return !shownItems.some(function (i) {return i == item});
      }
    });
  });
</script>

<my-element></my-element>


</body>
</html>
Run Code Online (Sandbox Code Playgroud)

polymer polymer-1.0

4
推荐指数
1
解决办法
4313
查看次数

在 VSTS 中“断开”分叉 Git 存储库

在 VSTS 中,我分叉了一个存储库来开发与原始存储库不同的产品。

当我在我的分叉存储库中从分支创建 PR 到主控时,VSTS 默认会合并到原始存储库中。我必须确保每个 PR 都不会错误地合并到原始存储库中。 VSTS 新公关菜单

VSTS 似乎认为我可能想将我的分叉存储库中的更改合并到原始存储库中。我没有这样做的计划。如何告诉 VSTS 将我的分叉存储库与原始存储库“断开连接”?

azure-devops

4
推荐指数
1
解决办法
1288
查看次数

标签 统计

azure-devops ×1

polymer ×1

polymer-1.0 ×1