Last active
April 27, 2023 03:04
-
-
Save ryenski/c9de022dc94c16131971b64d49c0778d to your computer and use it in GitHub Desktop.
Stimulus.js + Vue.js
This file contains 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 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 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