瀏覽代碼

fix Awesomplete not refreshing after passwords update

pull/342/head
Guillaume Vincent 7 年之前
父節點
當前提交
6523044754
共有 1 個檔案被更改,包括 15 行新增11 行删除
  1. +15
    -11
      src/views/PasswordGenerator.vue

+ 15
- 11
src/views/PasswordGenerator.vue 查看文件

@@ -176,17 +176,6 @@
});
},
mounted(){
const self = this;
new Awesomplete(this.$refs.site, {
list: this.passwords.map(password => {
return {label: password.site + ' ' + password.login, value: password}
}),
replace: function (password) {
self.$store.dispatch('savePassword', {password: password.value});
this.input.value = password.value.site;
}
});

if (this.password.site) {
this.$refs.login.focus();
} else {
@@ -205,6 +194,21 @@
}
},
watch: {
'passwords': function (passwords) {
var site = document.getElementById('site');
const self = this;
if (site !== null && passwords.length > 0) {
new Awesomplete(site, {
list: passwords.map(password => {
return {label: password.site + ' ' + password.login, value: password}
}),
replace: function (password) {
self.$store.dispatch('savePassword', {password: password.value});
this.input.value = password.value.site;
}
});
}
},
'password.site': function () {
this.cleanErrors();
},


Loading…
取消
儲存