mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-25 10:24:38 +08:00
Use computed to handle nested v-models, better pattern
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<b-input-group>
|
||||
<b-input v-model="value" placeholder="Type to Search" />
|
||||
<b-input v-model="filter" placeholder="Type to Search" />
|
||||
<b-input-group-append>
|
||||
<b-btn :disabled="!value" @click="value = ''">Clear</b-btn>
|
||||
<b-btn :disabled="!filter" @click="filter = ''">Clear</b-btn>
|
||||
</b-input-group-append>
|
||||
</b-input-group>
|
||||
</template>
|
||||
@@ -15,9 +15,14 @@ Vue.use(BootstrapVue);
|
||||
|
||||
export default {
|
||||
props: ["value"],
|
||||
watch: {
|
||||
value: function(new_value) {
|
||||
this.$emit("input", new_value);
|
||||
computed: {
|
||||
filter: {
|
||||
get() {
|
||||
return this.value;
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('input', val);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user