// Header/Footer
async searchData() {
this.$emit("input", {data: this.searchCards, ref: 'header'});
},
// App
methods: {
searchData({data, ref}) {
this.search = data;
this.resetInputs(ref)
},
resetInputs(ref) {
const refs = ['header', 'footer'],
refsToReset = refs.filter(e => e !== ref)
refsToReset.forEach(e => this.$refs[e].searchCards = '')
}
}
<script>
//data/Content.vue
export default {
1: { id: 1, title: "title-1", short: "short-1", body: "body-1", icon: "", slug: "" },
2: { id: 2, title: "title-2", short: "short-2", body: "body-2", icon: "", slug: "" }
}
</script>
<select ref="selectr" v-model="selected" @input="onInput(e)">
<option v-for="(item, index) of list" :key="index" :value="item">{{ item }}</option>
</select>
selected: {
get() {
return this.vuex;
},
set(value) {
if (window.confirm("Realy change select?")) {
this.vuex = value;
} else {
this.$refs.selectr.value = this.vuex;
}
}
}