-
-
Save fomigo/78f180e052efedecdc7cb3d5f4ca2c11 to your computer and use it in GitHub Desktop.
Stimulus.js + Vue.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
}); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div data-controller="hello"></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment