File tree Expand file tree Collapse file tree 5 files changed +78
-0
lines changed Expand file tree Collapse file tree 5 files changed +78
-0
lines changed Original file line number Diff line number Diff line change
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/button.js "> </ script >
12
+ </ body >
13
+ </ html >
Original file line number Diff line number Diff line change
1
+ import { createApp } from "vue" ;
2
+ import ButtonApp from "./components/ButtonApp.vue" ;
3
+
4
+ createApp ( ButtonApp ) . mount ( "#app" ) ;
Original file line number Diff line number Diff line change
1
+ <script setup>
2
+
3
+ import MyButton from " ./MyButton.vue" ;
4
+
5
+ function clickHandler (){
6
+ alert (" You click me" );
7
+ }
8
+ </script >
9
+
10
+ <template >
11
+ <MyButton class =" button" @click =" clickHandler" name =" Eko" contoh =" Kurniawan" />
12
+ </template >
13
+
14
+ <style scoped>
15
+ .button {
16
+ display : inline-block ;
17
+ padding : 10px 20px ;
18
+ background-color : #007bff ;
19
+ color : #fff ;
20
+ font-size : 16px ;
21
+ border : none ;
22
+ border-radius : 4px ;
23
+ cursor : pointer ;
24
+ text-align : center ;
25
+ transition : background-color 0.3s ease , transform 0.2s ease ;
26
+ }
27
+
28
+ .button :hover {
29
+ background-color : #0056b3 ;
30
+ transform : scale (1.05 );
31
+ }
32
+
33
+ .button :active {
34
+ background-color : #00408d ;
35
+ transform : scale (0.98 );
36
+ }
37
+
38
+ .button :focus {
39
+ outline : 2px solid #80bdff ;
40
+ outline-offset : 2px ;
41
+ }
42
+ </style >
Original file line number Diff line number Diff line change
1
+ <script setup>
2
+ import {useAttrs } from " vue" ;
3
+
4
+ const props = defineProps ([" contoh" ])
5
+ console .info (props)
6
+
7
+ const attributes = useAttrs ();
8
+ console .info (attributes);
9
+
10
+ </script >
11
+
12
+ <template >
13
+ <button >My Button : {{attributes.name}}</button >
14
+ </template >
15
+
16
+ <style scoped>
17
+
18
+ </style >
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ export default defineConfig({
17
17
contact : "contact.html" ,
18
18
product : "product.html" ,
19
19
note : "note.html" ,
20
+ button : "button.html" ,
20
21
}
21
22
}
22
23
}
You can’t perform that action at this time.
0 commit comments