export default class VuePage extends React.Component {
constructor (props) {
super(props)
this.vm = new Vue({ /* ... */ })
}
componentDidMount () {
this.vm.$mount('#vue-app')
}
componentWillUnmount () {
this.vm.$destroy()
}
render () {
return <div id='vue-app'></div>
}
}
<user-list :users="<%- users.toJSON() %>"></user-list>
<user-list :users="<%- users.toJSON() %>"></user-list>
<!-- Vue -->
<% if (Application.env === 'development') { %>
<script src="https://unpkg.com/vue"></script>
<% } else { %>
<script src="https://unpkg.com/vue/dist/vue.min.js"></script>
<% } %>
</head>
<body>
<!-- Mount point -->
<div id="app">
<%- yield %>
</div>
<!-- App -->
<script>
new Vue({
el: '#app',
// Universal server-data
data: {
csrfToken: '<%- Application.csrfToken %>'
}
})
</script>
<user-list :users="<%- users.toJSON() %>"></user-list>
Vue.component('user-list', {
// ...
})
Vue.component('flash-message', {
// ...
})
template: '\
<li>\
{{ todo.text }}\
</li>\
'
template: `
<li>
{{ todo.text }}
</li>
`
+ simple
+ opinionated
+ SSR
+ control
+ tests
+ control
+ tests
+ progressive
...
and soon...
@chrisvfritz