diff --git a/js/controls/people.js b/js/controls/people.js index a578f33..6a71979 100644 --- a/js/controls/people.js +++ b/js/controls/people.js @@ -5,7 +5,7 @@ Vue.component('people', { search: "" }; }, - computed: { + recomputed: { people: { get: function () { if (app.people == null) return null; @@ -17,7 +17,7 @@ Vue.component('people', { continue; if (app.people[i].getName() == null) continue; - if (app.people[i].getName().toLowerCase().indexOf(this.search.toLowerCase()) != -1) + if (this.search == "" || app.people[i].getName().toLowerCase().indexOf(this.search.toLowerCase()) != -1) results.push(app.people[i]); } return results; @@ -38,7 +38,11 @@ Vue.component('people', { size: 5000 }); }, - watch: {}, + watch: { + search: function(newSearch){ + this.$recompute("people"); + } + }, methods: { changeSelected: function (pk) { app.subject = pk; diff --git a/js/controls/profile.js b/js/controls/profile.js index 8b99674..6757b6d 100644 --- a/js/controls/profile.js +++ b/js/controls/profile.js @@ -9,7 +9,7 @@ Vue.component('profile', { inContactList: null } }, - computed: { + recomputed:{ person: { get: function () { if (this.personObj != null) @@ -20,9 +20,13 @@ Vue.component('profile', { return null; }, set: function(person){ - this.personObj = person; + this.personObj = person; + this.$recompute("person"); } - }, + } + + }, + computed: { name: { get: function () { if (this.person == null) @@ -135,6 +139,7 @@ Vue.component('profile', { if (p.seeks == null) p.seeks = []; this.personObj = p; + this.$recompute("person"); if (this.pk == app.subject) app.subjectPerson = p; if (this.pk == app.me) @@ -276,18 +281,18 @@ Vue.component('profile', { template: '
' + '' + '' + - '' + - '' + + '' + + '' + '' + '' + - '' + + '' + '' + '' + '' + - ' ' + - ' ' + - ' ' + - ' ' + + ' ' + + ' ' + + ' ' + + ' ' + '' + ''+ ''+ diff --git a/js/vendor/vue-recomputed.js b/js/vendor/vue-recomputed.js index 3b42a07..c5058e6 100644 --- a/js/vendor/vue-recomputed.js +++ b/js/vendor/vue-recomputed.js @@ -27,6 +27,8 @@ Vue.mixin({ this$1.$options.computed[key] = function (vm) { /* eslint-disable-next-line */ data[me][key]; + if (EcObject.isObject(this$1.$options.recomputed[key])) + return this$1.$options.recomputed[key].get.call(vm, vm) return this$1.$options.recomputed[key].call(vm, vm) }; });