Answer the question
In order to leave comments, you need to log in
What's wrong - props don't work in VUE + Ruby on Rails?
Unable to pass props to VUE.
In the vue console I get:
props:
message: undefined
<div id="rails" class="container" data-behavior="vue">
<app :message="<%= "Any text".to_json %>"></app>
</div>
import Vue from 'vue'
import App from '../app.vue'
document.addEventListener('DOMContentLoaded', () => {
const el = document.body.appendChild(document.createElement('application'))
const app = new Vue({
el: '[data-behavior="vue"]',
render: h => h(App, 'app')
})
})
<template>
<div id="app">
<p>{{ message }}</p>
</div>
</template>
<script>
export default {
props: ['message'],
}
</script>
<style scoped>
p {
font-size: 2em;
text-align: center;
}
</style>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question