Skip to content

Instantly share code, notes, and snippets.

@ryenski
Last active April 27, 2023 03:04
Show Gist options
  • Save ryenski/c9de022dc94c16131971b64d49c0778d to your computer and use it in GitHub Desktop.
Save ryenski/c9de022dc94c16131971b64d49c0778d 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