我的问题与已经存在的问题相同,因为聚合物paper-dialog.open()
未定义
我的进口包括
<link rel="import" src="../bower_components/paper-date-picker/paper-date-picker.html">
<link rel="import" src="../bower_components/paper-styles/demo-pages.html">
<link rel="import" src="../bower_components/paper-dialog/paper-dialog.html">
<link rel="import" src="../bower_components/paper-date-picker/paper-date-picker-dialog-style.html">
<link rel="import" href="../bower_components/paper-button/paper-button.html">
对话框 HTML 部分
<paper-button class="btn" on-tap="showDialog" raised>Change Date</paper-button>
<paper-dialog id="dialog1" class="paper-date-picker-dialog" modal on-iron-overlay-closed="dismissDialog">
<paper-date-picker id="picker1" date="[[appuser.date]]"></paper-date-picker>
<div class="buttons">
<paper-button dialog-dismiss>Cancel</paper-button>
<paper-button dialog-confirm>OK</paper-button>
</div>
</paper-dialog>
代码
Polymer({
is: "cp-login",
properties: {
appuser: {
type: Object,
value: {}
}
},
saveAPPUSER: function() {
if (!this.$.formappuser.validate()) return;
this.$.submitAPPUSER.url = "http://localhost:3000/app/appuser";
this.$.submitAPPUSER.body = this.appuser;
this.$.submitAPPUSER.generateRequest();
},
submitAPPUSERSuccess: function(data) {
console.log(data)
},
submitAPPUSERError: function(err) {
console.log(err)
},
showDialog : function(){
this.$.dialog1.open();
},
ready : function(){
this.appuser.date = new Date(2017, 3, 13);
this.showDialog();
}
})
对我来说,这里没有任何功能切换,通过代码或直接在 html 中打开dialog1.open()
。
知道我做错了什么吗?