Last active
May 23, 2023 13:15
-
-
Save harshals/4fca48c6dc9f1da235fe01798363c6bd to your computer and use it in GitHub Desktop.
simple vue3 options and composition component
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
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; | |
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 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> | |
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> | |
<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