Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Vue 3 debugging reference for reactivity issues, computed errors, watcher bugs, async failures, and SSR hydration problems.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
reference/textarea-no-interpolation.md
1---2title: Textarea Interpolation is One-Way Only - Use v-model for Two-Way Binding3impact: HIGH4impactDescription: Using {{ text }} inside textarea displays initial value but user input does NOT update the ref5type: capability6tags: [vue3, v-model, forms, textarea, interpolation, template]7---89# Textarea Interpolation is One-Way Only - Use v-model for Two-Way Binding1011**Impact: HIGH** - Interpolation in textarea (`{{ text }}`) provides one-way binding only - it displays the initial value but user input does NOT update the ref. This creates a confusing disconnect where the textarea shows content but edits are silently lost.1213Unlike v-model which provides two-way binding, interpolation only renders the initial ref value into the textarea. When users type, the ref remains unchanged, making form submissions return stale data. Always use v-model for two-way binding in textareas.1415## Task Checklist1617- [ ] Never use interpolation inside textarea tags18- [ ] Always use v-model for textarea two-way binding19- [ ] Search codebase for `<textarea>{{` patterns that may be silently broken20- [ ] Add linting rules to catch this pattern if possible2122**Incorrect:**23```html24<script setup>25import { ref } from 'vue'2627const message = ref('Hello World')28</script>2930<template>31<!-- WRONG: One-way binding only! Shows initial value but edits don't update ref -->32<textarea>{{ message }}</textarea>3334<!-- Also WRONG: User can type but changes are lost -->35<textarea>{{ userBio }}</textarea>3637<!-- The textarea displays content but ref never updates -->38</template>39```4041**Correct:**42```html43<script setup>44import { ref } from 'vue'4546const message = ref('Hello World')47</script>4849<template>50<!-- CORRECT: Use v-model for textarea -->51<textarea v-model="message"></textarea>5253<!-- For read-only display, still use v-model or :value -->54<textarea v-model="message" readonly></textarea>5556<!-- Or one-way binding with :value -->57<textarea :value="message" readonly></textarea>58</template>59```6061```html62<!-- With placeholder and other attributes -->63<textarea64v-model="message"65placeholder="Enter your message..."66rows="5"67maxlength="500"68></textarea>69```7071## Reference72- [Vue.js Form Input Bindings - Multiline text](https://vuejs.org/guide/essentials/forms.html#multiline-text)73