v-model-with-props
<div class="searchBarWrapper">
<div></div>
<div class="searchBar">
<v-text-field
v-model="propModel"
:label="placeholder || '검색'"
box/>
</div>
</div>Last updated
<div class="searchBarWrapper">
<div></div>
<div class="searchBar">
<v-text-field
v-model="propModel"
:label="placeholder || '검색'"
box/>
</div>
</div>Last updated
export default {
name: 'SearchBar',
props: {
placeholder: String,
handleChangeText: Function,
},
data: () => ({
text: '',
}),
computed: {
propModel: {
get() {
return this.text;
},
set(value) {
this.text = value;
this.handleChangeText(value);
}
}
}
};<search-bar :handle-change-text="handleChangeSearchText"/>handleChangeSearchText(text) {
this.searchInputText = text;
},