Skip to content

Instantly share code, notes, and snippets.

@fomigo
Forked from ryenski/hello.vue
Created May 19, 2020 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fomigo/78f180e052efedecdc7cb3d5f4ca2c11 to your computer and use it in GitHub Desktop.
Save fomigo/78f180e052efedecdc7cb3d5f4ca2c11 to your computer and use it in GitHub Desktop.
Stimulus.js + Vue.js
<template>
<div id="app">
<p>{{ message }}</p>
</div>
</template>
<script>
export default {
data: function () {
return {
message: "Hello Vue!"
}
}
}
</script>
<style scoped>
p {
font-size: 2em;
text-align: center;
}
</style>
import { Controller } from "stimulus";
import Vue from "vue/dist/vue.esm";
import App from "../hello.vue";
export default class extends Controller {
connect() {
const el = this.element;
const app = new Vue({
el,
render: h => h(App)
});
}
}
<div data-controller="hello"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment