-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(BaseListbox): allow value prop as model with v-model.prop (#76)
- Loading branch information
1 parent
ddb76f5
commit 908e585
Showing
2 changed files
with
92 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<script setup lang="ts"> | ||
definePageMeta({ | ||
title: 'Listbox', | ||
icon: 'ic:round-menu-open', | ||
description: | ||
'Test use of both objects and object value props in listbox models', | ||
section: 'form', | ||
}) | ||
const frameworks = [ | ||
{ label: 'React', value: 'react' }, | ||
{ label: 'Vue', value: 'vue' }, | ||
{ label: 'Angular', value: 'angular' }, | ||
{ label: 'Svelte', value: 'svelte' }, | ||
] | ||
const model = ref({ | ||
frameworkId: '', | ||
framework: {}, | ||
}) | ||
const properties = { | ||
value: 'value', | ||
label: 'label', | ||
} | ||
</script> | ||
|
||
<template> | ||
<div | ||
class="flex flex-col gap-12 [&>*]:p-8 [&>:nth-child(odd)]:bg-muted-100 dark:[&>:nth-child(odd)]:bg-muted-900 pb-32" | ||
> | ||
<div> | ||
<BaseHeading size="xl" weight="medium" class="mb-10"> | ||
Default Listbox | ||
</BaseHeading> | ||
<div class="grid grid-cols-3 gap-4"> | ||
<BaseListbox | ||
v-model="model.framework" | ||
:items="frameworks" | ||
:properties="properties" | ||
/> | ||
<pre> {{ model }}</pre> | ||
<BaseButton @click="model.framework = frameworks[1]"> | ||
Set Framework to Vue | ||
</BaseButton> | ||
</div> | ||
</div> | ||
|
||
<div> | ||
<BaseHeading size="xl" weight="medium" class="mb-10"> | ||
Listbox with Object Key | ||
</BaseHeading> | ||
<div class="grid grid-cols-3 gap-4"> | ||
<BaseListbox | ||
v-model.prop="model.frameworkId" | ||
:items="frameworks" | ||
:properties="properties" | ||
/> | ||
<pre> {{ model }}</pre> | ||
<BaseButton @click="model.frameworkId = 'vue'"> | ||
Set Framework to Vue | ||
</BaseButton> | ||
</div> | ||
</div> | ||
</div> | ||
</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