2017-05-03 73 views
0

這可能很簡單,但我現在無法弄清楚。我有一個聚合物紙 - 收音機組與各種按鈕,但選擇不會採取,直到第二次點擊。紙張收音機組只需要第二次點擊即可選擇

<paper-radio-group selected="{{radioSelected}}" on-change="viewChanger"> 
    <paper-radio-button name="none">None</paper-radio-button> 
    <paper-radio-button name="sidebyside">Side by side</paper-radio-button> 
    <paper-radio-button name="popup">Pop-up</paper-radio-button> 
</paper-radio-group> 

而且JS:

Polymer({ 
    is: 'x-menu', 
    properties: { 
     radioSelected: { 
     type: String, 
     value: "none" 
     } 
    }, 
    viewChanger: function() { 
    console.log(this.radioSelected); 
    } 
}); 

感謝您的幫助。我是Polymer的新手。

+0

你可以把這裏的問題? https://github.com/PolymerElements/paper-radio-group –

回答

1

試試這個好:

<paper-radio-group selected="{{radioSelected}}"> 
    <paper-radio-button name="none">None</paper-radio-button> 
    <paper-radio-button name="sidebyside">Side by side</paper-radio-button> 
    <paper-radio-button name="popup">Pop-up</paper-radio-button> 
</paper-radio-group> 

而且你的JS:

Polymer({ 
    is: 'x-menu', 
    properties: { 

    radioSelected: { 
     type: String, 
     value: "none", 
     observer: '_radioGroupChanged' 
    } 
    }, 

    _radioGroupChanged: function(radioSelected) { 
    console.log(radioSelected); 
    } 
}); 
+0

完美!非常感謝! – Vims