2
显示在HTML数据我有以下文件:采用高分子
店categories.html
<link rel="import" href="../bower_components/polymer/polymer-element.html">
<dom-module id="shop-category-data">
<script>
(function() {
let val = "Country";
class ShopCategoryData extends Polymer.Element {
static get is() { return 'shop-category-data'; }
static get properties() { return {
regionFilter: {
type: String,
value: val,
notify: true
}
}
}
}
customElements.define(ShopCategoryData.is, ShopCategoryData);
})();
</script>
</dom-module>
这里是店app.html文件
<link rel="import" href="shop-category-data.html">
<dom-module id="shop-app">
<template>
<shop-category-data regionFilter="{{regionFilter}}"></shop-category-data>
<h1>HELLO</h1>
<h1>{{regionFilter}}</h1>
</template>
<script>
class ShopApp extends Polymer.Element {
static get is() { return 'shop-app'; }
}
customElements.define(ShopApp.is, ShopApp);
</script>
</dom-module>
我试图将region
的价值从商店类别传递给shot-app。它正在显示HELLO
,但country
未显示。我认为这两行应该处理显示,但它们不是。
<h1>HELLO</h1>
<h1>{{regionFilter}}</h1>