resolve issue in prop binding
This commit is contained in:
parent
d6f9f34ad8
commit
2100cb247d
@ -24,8 +24,7 @@ const AutoCompleteInput = {
|
||||
data () {
|
||||
return {
|
||||
caret: 0,
|
||||
highlighted: 0,
|
||||
text: this.value
|
||||
highlighted: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -42,7 +41,7 @@ const AutoCompleteInput = {
|
||||
return (this.wordAtCaret || {}).word || ''
|
||||
},
|
||||
wordAtCaret () {
|
||||
const word = Completion.wordAtPosition(this.text, this.caret - 1) || {}
|
||||
const word = Completion.wordAtPosition(this.value, this.caret - 1) || {}
|
||||
return word
|
||||
},
|
||||
candidates () {
|
||||
@ -113,7 +112,7 @@ const AutoCompleteInput = {
|
||||
}
|
||||
},
|
||||
replace (replacement) {
|
||||
this.text = Completion.replaceWord(this.text, this.wordAtCaret, replacement)
|
||||
this.$emit('input', Completion.replaceWord(this.value, this.wordAtCaret, replacement))
|
||||
const el = this.$el.querySelector('textarea')
|
||||
el.focus()
|
||||
this.caret = 0
|
||||
@ -125,8 +124,7 @@ const AutoCompleteInput = {
|
||||
e.preventDefault()
|
||||
const candidate = this.candidates[this.highlighted]
|
||||
const replacement = candidate.utf || (candidate.screen_name + ' ')
|
||||
this.text = Completion.replaceWord(this.text, this.wordAtCaret, replacement)
|
||||
this.$emit('input', this.text)
|
||||
this.$emit('input', Completion.replaceWord(this.value, this.wordAtCaret, replacement))
|
||||
const el = this.$el.querySelector('textarea') || this.$el.querySelector('input')
|
||||
el.focus()
|
||||
this.caret = 0
|
||||
|
@ -4,8 +4,8 @@
|
||||
v-if="multiline"
|
||||
ref="textarea"
|
||||
rows="1"
|
||||
:value="text" :class="classObj" :id="id" :placeholder="placeholder"
|
||||
@input="text = $event.target.value, $emit('input', $event.target.value), autoResize && resize($event)"
|
||||
:value="value" :class="classObj" :id="id" :placeholder="placeholder"
|
||||
@input="$emit('input', $event.target.value), autoResize && resize($event)"
|
||||
@click="setCaret"
|
||||
@keyup="setCaret"
|
||||
@keydown.down="cycleForward"
|
||||
@ -22,8 +22,8 @@
|
||||
<input
|
||||
v-else
|
||||
ref="textarea"
|
||||
:value="text" :class="classObj" :id="id" :placeholder="placeholder"
|
||||
@input="text = $event.target.value, $emit('input', $event.target.value), autoResize && resize($event)"
|
||||
:value="value" :class="classObj" :id="id" :placeholder="placeholder"
|
||||
@input="$emit('input', $event.target.value), autoResize && resize($event)"
|
||||
@click="setCaret"
|
||||
@keyup="setCaret"
|
||||
@keydown.down="cycleForward"
|
||||
|
Loading…
Reference in New Issue
Block a user