Skip to content

Commit 2f84b7d

Browse files
committed
chore: add docs about v-model
1 parent 67367c6 commit 2f84b7d

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

+25
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,28 @@ Assign a ref to the Drawer component
6868
```
6969

7070
And use `this.$refs.drawer.open(side)` where `side` is a string: `left`, `right`, `top` or `bottom`.
71+
72+
### Using v-model to toggle the drawer
73+
74+
The drawer can be opened through v-model. This is useful as it allows controlling the drawer state with Vue's reactivity system. For example, the value of v-model could easily come from a vuex store.
75+
76+
```xml
77+
<MultiDrawer v-model="drawerState" />
78+
```
79+
80+
```js
81+
export default {
82+
data() {
83+
return {
84+
drawerState: false // closed
85+
}
86+
},
87+
88+
methods: {
89+
doStuff() {
90+
// do stuff
91+
this.drawerState = 'left' // this will open the left drawer
92+
}
93+
}
94+
}
95+
```

0 commit comments

Comments
 (0)