Textarea v-model initial value with VueJS and Laravel
You are trying to pass a PHP variable value to a separate Javascript file.
Here's how I would do it:
Declare a global variable detailsFromLaravelContoller
to store $detailsFromLaravelContoller as a string value
<script> var detailsFromLaravelContoller = @json($detailsFromLaravelContoller);</script><textarea v-model="message"></textarea>
use the global variable in Javascript file
data: { message: detailsFromLaravelContoller,},
You can initialize the v-model
in data with your laravel variable.
window.onload = function(){ var editor = new Vue({ el: '#editor', data: { message: {!! $detailsFromLaravelContoller !!}, compiledMarkdown: marked('', { sanitize: true }), }, watch: { markdown: function () { this.compiledMarkdown = marked(this.message, { sanitize: true }) } }, methods: { } }) }