File tree Expand file tree Collapse file tree 4 files changed +71
-0
lines changed
playground/scenarios/vueUse Expand file tree Collapse file tree 4 files changed +71
-0
lines changed Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div class =" app-container" >
3
+ <Coordinate label =" X" :value =" x" />
4
+ <Coordinate label =" Y" :value =" y" />
5
+ </div >
6
+ </template >
7
+
8
+ <script lang="ts" setup>
9
+ import { useMouse } from ' @vueuse/core'
10
+ import Coordinate from ' ./Coordinate.vue'
11
+
12
+ const { x, y } = useMouse ()
13
+ </script >
14
+
15
+ <style scoped>
16
+ .app-container {
17
+ display : grid ;
18
+ grid-auto-flow : column ;
19
+ gap : 1rem ;
20
+ justify-content : center ;
21
+ align-items : center ;
22
+ height : 100vh ;
23
+ font-family : monospace ;
24
+ }
25
+ </style >
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div class =" coordinate" >
3
+ <span class =" coordinate-value" >{{ value }}</span >
4
+ <span class =" coordinate-label" > Mouse {{ label }} </span >
5
+ </div >
6
+ </template >
7
+
8
+ <script lang="ts" setup>
9
+ defineProps <{
10
+ label: string
11
+ value: number
12
+ }>()
13
+ </script >
14
+
15
+ <style scoped>
16
+ .coordinate {
17
+ font-family : monospace ;
18
+ background-color : #f3f4f6 ; /* light-500 */
19
+ color : #111827 ; /* dark-900 */
20
+ display : flex ;
21
+ flex-direction : column ;
22
+ text-align : center ;
23
+ padding : 0.5rem ;
24
+ border-radius : 0.5rem ;
25
+ }
26
+ .coordinate-value {
27
+ font-size : 2.25rem ; /* text-4xl */
28
+ }
29
+ .coordinate-label {
30
+ font-size : 0.875rem ; /* text-sm */
31
+ margin-top : 0.5rem ;
32
+ color : #2563eb ; /* blue-600, 更明显 */
33
+ opacity : 0.8 ;
34
+ }
35
+ </style >
Original file line number Diff line number Diff line change
1
+ export default {
2
+ mainFile : 'App.vue' ,
3
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "imports" : {
3
+ "vue" : " https://unpkg.com/vue@3/dist/vue.esm-browser.js" ,
4
+ "@vueuse/core" :
" https://unpkg.com/@vueuse/[email protected] /index.mjs" ,
5
+ "@vueuse/shared" :
" https://unpkg.com/@vueuse/[email protected] /index.mjs" ,
6
+ "vue-demi" :
" https://cdn.jsdelivr.net/npm/[email protected] /lib/v3/index.mjs"
7
+ }
8
+ }
You can’t perform that action at this time.
0 commit comments