Skip to content

Commit 0a74325

Browse files
committed
Add profile page with Vue components and functionality
Introduce a new profile page with Vue-based components. The profile includes reactive state management for name and email using `provide` and `inject`, along with a profile address subcomponent. Update Vite configuration to include the new profile entry point.
1 parent dbdb042 commit 0a74325

File tree

6 files changed

+69
-0
lines changed

6 files changed

+69
-0
lines changed

Diff for: profile.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + Vue</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/profile.js"></script>
12+
</body>
13+
</html>

Diff for: src/components/Profile.vue

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<script setup>
2+
import {inject} from "vue";
3+
4+
const profile = inject("profile");
5+
</script>
6+
7+
<template>
8+
<h1>Profile</h1>
9+
<p>Name : {{ profile.name }}</p>
10+
<p>Email : {{ profile.email }}</p>
11+
</template>
12+
13+
<style scoped>
14+
15+
</style>

Diff for: src/components/ProfileAddress.vue

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<script setup>
2+
import {inject} from "vue";
3+
4+
const profile = inject("profile");
5+
</script>
6+
7+
<template>
8+
<h1>Profile Address : {{ profile.name }}</h1>
9+
<p>Address ...</p>
10+
</template>
11+
12+
<style scoped>
13+
14+
</style>

Diff for: src/components/ProfileApp.vue

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<script setup>
2+
import {provide, reactive} from "vue";
3+
import ProfileAddress from "./ProfileAddress.vue";
4+
import Profile from "./Profile.vue";
5+
6+
const profile = reactive({
7+
name: "Eko",
8+
9+
})
10+
11+
provide("profile", profile);
12+
</script>
13+
14+
<template>
15+
<input v-model="profile.name" type="text" placeholder="Name"/>
16+
<Profile/>
17+
<ProfileAddress/>
18+
</template>
19+
20+
<style scoped>
21+
22+
</style>

Diff for: src/profile.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import {createApp} from "vue";
2+
import ProfileApp from "./components/ProfileApp.vue";
3+
4+
createApp(ProfileApp).mount("#app");

Diff for: vite.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default defineConfig({
1919
note: "note.html",
2020
button: "button.html",
2121
home: "home.html",
22+
profile: "profile.html",
2223
}
2324
}
2425
}

0 commit comments

Comments
 (0)