-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
447050f
commit b29e756
Showing
13 changed files
with
168 additions
and
56 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
} | ||
|
||
.VPNavBarTitle a span { | ||
font-size: 22px !important; | ||
font-size: 24px !important; | ||
} | ||
|
||
body { | ||
|
36 changes: 36 additions & 0 deletions
36
docs/docs/components/usage/CounterComposablesIvueDestructuring.vue
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<script setup lang="ts"> | ||
import { CustomMouse } from './classes/CustomMouse'; | ||
import { ivue, iref, iuse } from 'ivue'; | ||
class Counter { | ||
count = iref(0); | ||
increment() { | ||
this.count++; | ||
} | ||
// x, y are Refs that will be unwrapped and destructured into this class | ||
x: CustomMouse['x']; // Unwrapped Ref<number> becomes -> number | ||
y: CustomMouse['y']; // Unwrapped Ref<number> becomes -> number | ||
total: CustomMouse['total']; // Unwrapped Ref<number> becomes -> number | ||
constructor() { | ||
({ | ||
x: this.x, | ||
y: this.y, | ||
total: this.total, | ||
} = iuse(CustomMouse, 5)); | ||
} | ||
} | ||
const counter = ivue(Counter); | ||
</script> | ||
<template> | ||
<a href="javascript:void(0)" @click="() => counter.increment()">Increment</a> | ||
Count: {{ counter.count }} <br /> | ||
Mouse X: {{ counter.x }}, Y: {{ counter.y }} | ||
<br /> | ||
Total (computed): {{ counter.total }} | ||
<br /> | ||
</template> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useMouse } from '@vueuse/core'; | ||
import { iuse, type UseComposable } from 'ivue'; | ||
|
||
type UseMouse = UseComposable<typeof useMouse> | ||
|
||
export class CustomMouse { | ||
|
||
x: UseMouse['x']; | ||
y: UseMouse['y']; | ||
|
||
constructor(public test: number) { | ||
({ x: this.x, y: this.y } = iuse(useMouse())) | ||
} | ||
|
||
get total() { | ||
return this.x + this.y; | ||
} | ||
} |
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
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
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
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
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
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
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
Oops, something went wrong.