【发布时间】:2016-05-18 09:54:24
【问题描述】:
在我的电子应用程序中, 我想通过对话框缓存文件路径更改,
Polymer({
is:'myelement',
properties:{
path:{
type:String,
defaultValue:'test',
observer:'_pathChanged'
}
}
_pathChanged: function(newalue,oldvalue){
alert('new:' + newvalue + 'oldvalue' + oldvalue)
}
})
关于对话框
showDialog:function(){
var remote = require('remote')
var dialog = remote.require('dialog')
dialog.showOpenDialog({properties:['openDirectory'],
function(dirPath){
if (dirPath){
this.path=dirPath
}
}
}
但是,当在对话框中选择不同的文件时,观察者不起作用。
【问题讨论】:
-
您是否必须启用与
notify: true的双向绑定?
标签: javascript dialog polymer polymer-1.0 electron