Я пытаюсь добиться чего-то, где в данном вводе я делаю строку редактируемой или не редактируемой (только для чтения) в зависимости от контекста текста в vue js.
Например : У меня есть текст: Меня зовут $ John Doe $ Теперь мой код vue js должен повторять строку, и текст между $ можно редактировать.
HTML:
<template>
<textarea cols = "10" rows = "10" disabled>{{q | makeTextEditableByCondition}}</textarea>
<input type = "text" v-model = "editText">
</template>
<script>
export default {
data() {
q : "My name is $John Doe$ from NYC,
editText: null,
disabled: true
}
filters:{
makeTextEditableByCondition(text){
let splittedText = text.split("$");
let this.editText = splittedText[1]
splittedText.splice(1,1)
return splittedText.join(" ")
}
</script>
Но это все еще усложняет процесс, и я не добиваюсь должного результата.
Любая помощь будет высоко оценена



![Безумие обратных вызовов в javascript [JS]](https://i.imgur.com/WsjO6zJb.png)


многое не ладится:
q : "My name is $John Doe$ from NYC",
Не заканчивающийся тег для ваших фильтров "}"
... Filters should be pure functions and should not be dependent on this context. If you need this you should use a computed property or just a method e.g. https://github.com/vuejs/vue/issues/5998
Вот базовое решение с вычисленным:
<div id = "app">
<textarea cols = "10" rows = "10" disabled>{{ qComputed }}</textarea>
<input type = "text" v-model = "editText">
</div>
new Vue({
el: "#app",
data: {
q: "My name is $John Doe$ from NYC",
editText: null,
disabled: true
},
computed: {
qComputed(){
let splittedText = this.q.split('$')
splittedText[1] = this.editText
return splittedText.join` `
}
}
})