0
當試圖與conditional attribute聚合物條件屬性
<polymer-element name="hover-button" extends="paper-button" hover?="{{hover}}" attributes="hover">
我運行到以下錯誤
Uncaught InvalidCharacterError: Failed to execute 'setAttribute' on 'Element': 'hover?' is not a valid attribute name.
仍然在聚合物0.5定義的元素。 下面是完整的代碼:
<polymer-element name="hover-button" extends="paper-button" hover?="{{hover}}">
<template>
<shadow></shadow>
</template>
<script>
(function(){
Polymer('hover-button', {
ready: function(){
this.addEventListener('mouseover', function(){ this.hover = true; }.bind(this));
this.addEventListener('mouseout', function(){ this.hover = false; }.bind(this));
},
activeChanged: function(){ /* foo */ },
hoverChanged: function(){ /* bar */ }
});
})();
</script>
</polymer-element>
我嘗試將'hover'聲明爲已發佈屬性,但錯誤仍然顯示。有沒有辦法做到這一點聲明? – Renaud