Skip to content

Instantly share code, notes, and snippets.

@JeffreyWay
Last active May 26, 2022 16:50
Show Gist options
  • Save JeffreyWay/27072fec755753852a74771adcb5ca80 to your computer and use it in GitHub Desktop.
Save JeffreyWay/27072fec755753852a74771adcb5ca80 to your computer and use it in GitHub Desktop.
Learn Vue 3: Step by Step - Episode 3, Your First Custom Vue Component - https://laracasts.com/series/learn-vue-3-step-by-step/episodes/4
<!doctype html>
<html lang="en" class="h-full">
<head>
<meta charset="UTF-8">
<title>Episode 4: Your First Custom Vue Component</title>
<script src="https://unpkg.com/vue@3"></script>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="h-full grid place-items-center">
<div id="app">
<app-button>Submit</app-button>
</div>
<script>
let app = {
components: {
'app-button': {
template: `
<button
class="bg-gray-200 hover:bg-gray-400 border rounded px-5 py-2 disabled:cursor-not-allowed"
:disabled="processing"
>
<slot />
</button>
`,
data() {
return {
processing: false
};
}
},
}
};
Vue.createApp(app).mount('#app');
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment