gpt4 book ai didi

dart - 当准备好初始化选定的选项卡时,聚合物选择器不会触发选项卡选择更改

转载 作者:行者123 更新时间:2023-12-03 03:47:04 26 4
gpt4 key购买 nike

刚提交了一个问题https://github.com/ErikGrimes/polymer_elements/issues/117。在这里复制。

我正在将Polymer-ui-tabs与Polymer-ui-pages一起使用,单击选项卡时它不能可靠地更改页面。

要重现,请使用以下代码。然后

  • 观察到已选择了Two选项卡,并显示了Two页面
  • 单击Three选项卡,然后显示Three页面
  • 单击Two选项卡。内容仍显示Three页面

  • 重复从镖代码中删除的 selectedTab = 1;。现在,这些选项卡可以正常工作。

    polymer_tabs_issue.html

    <!DOCTYPE html>
    <polymer-element name="polymer-tabs-issue" attributes="selectedTab">

    <link rel="import" href="packages/polymer_ui_elements/polymer_ui_tabs/polymer_ui_tabs.html">
    <link rel="import" href="packages/polymer_ui_elements/polymer_ui_pages/polymer_ui_pages.html">
    <link rel="import" href="packages/polymer_elements/polymer_layout/polymer_layout.html">

    <template>
    <style type="text/css">
    polymer-ui-tabs {
    width: 100%;
    height: 70px; /* not sure why need to set height */
    }
    polymer-ui-pages {
    width: 100%;
    border: 1px solid gray;
    margin: 0px 5px 5px 5px;
    }
    polymer-ui-tabs > * {
    width: 30%;
    }
    </style>

    <div style="width:100%;height:100%;">
    <polymer-layout vertical></polymer-layout>

    <div>
    <polymer-layout></polymer-layout>
    <polymer-ui-tabs selected="{{selectedTab}}">
    <span>One</span>
    <span>Two</span>
    <span>Three</span>
    </polymer-ui-tabs>
    <div flex></div>
    </div>

    <polymer-ui-pages selected="{{selectedTab}}" flex>
    <span>One</span>
    <span>Two</span>
    <span>Three</span>
    </polymer-ui-pages>
    </div>

    </template>

    <script type="application/dart" src="polymer_tabs_issue.dart">
    </script>

    </polymer-element>

    index.html

    <!doctype html>

    <html>
    <head>
    <title>polymer tabs issue</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="import" href="polymer_tabs_issue.html">
    <link rel="import" href="packages/polymer_elements/polymer_layout/polymer_layout.html">
    </head>
    <body>
    <polymer-layout></polymer-layout>
    <polymer-tabs-issue flex></polymer-tabs-issue>

    <script type="application/dart">export 'package:polymer/init.dart';</script>
    <script src="packages/browser/dart.js"></script>
    </body>
    </html>

    polymer-tabs-issue.dart

    library polymer_tabs_issue;

    import 'package:polymer/polymer.dart';

    @CustomTag('polymer-tabs-issue')
    class PolymerTabsIssueElement extends PolymerElement {

    @published
    dynamic selectedTab;

    PolymerTabsIssueElement.created(): super.created();

    @override
    void ready() {
    selectedTab = 1;
    }

    }

    最佳答案

    你可以试试吗

      @override
    void ready() {
    selectedTab = '1';
    }

    它对我有用,但是我的聚合物选择/聚合物选择器包含一些尚未发布的修改

    关于dart - 当准备好初始化选定的选项卡时,聚合物选择器不会触发选项卡选择更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22122280/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com