data binding - Vue.js: insert value into textfield but don't bind it -
i facing interesting problem: have form want insert old values (if form submitted before) this:
<input type="text" :value="oldname" id="name" /> now problem can't overwrite oldname variable this, yes, have old value in there, can't change anymore. can think of solution? want value in textfield, want user able change it. thank you!
sounds adding v-once input field solve problem. v-once means oldname used render value once, after normal string literal.
<input type="text" :value="oldname" id="name" v-once/> in case want user able modify value use v-model instead of v-bind. v-model provides 2 way binding when user writes in input field reflected in value.
<input type="text" v-model="oldname" id="name" v-once/>
Comments
Post a Comment