Skip to content

Instantly share code, notes, and snippets.

@harshals
Last active May 23, 2023 13:15
Show Gist options
  • Save harshals/4fca48c6dc9f1da235fe01798363c6bd to your computer and use it in GitHub Desktop.
Save harshals/4fca48c6dc9f1da235fe01798363c6bd to your computer and use it in GitHub Desktop.
simple vue3 options and composition component
const App2 = {
data() {
return {
message: "Hello from App 2!",
};
},
methods: {
modifyMessage() {
return "Modified Message"
},
},
template: `
<div>
<style> p { color:blue; }</style>
<p>{{ message }}</p>
<p class="btn huge btn-link">{{ modifyMessage() }}</p>
</div>
`,
};
export default App2;
<template>
<div class="app1">
Application Gist {{message}}
</div>
</template>
<script setup >
import { ref } from 'vue'
const message = ref("from SFC")
</script>
<style scoped>
@import 'https://eformz.in/app/static/extra/temp/packed.css';
.app1 { background-color: red;}
</style>
<template>
<div>
<h1>{{ greeting }}</h1>
<p>{{ message }}</p>
</div>
</template>
<script>
export default {
name: 'RemoteComponent',
data() {
return {
greeting: 'Hello',
message: 'This component was loaded remotely!'
};
}
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment