Skip to content

Commit

Permalink
feat: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
haoziqaq committed Dec 25, 2024
1 parent 3e0e239 commit 2ba4de6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
20 changes: 18 additions & 2 deletions packages/varlet-ui/src/menu-select/example/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { computed, ref } from 'vue'
import { watchLang, onThemeChange, AppType } from '@varlet/cli/client'
import { use, t } from './locale'
import { Snackbar } from '@varlet/ui'
const value = ref()
const valueNormal = ref()
Expand Down Expand Up @@ -125,6 +126,10 @@ watchLang((lang) => {
})
onThemeChange()
function handleSelect(value) {
Snackbar(`Select: ${value}`)
}
</script>

<template>
Expand All @@ -139,6 +144,17 @@ onThemeChange()
</template>
</var-menu-select>

<app-type>{{ t('onSelect') }}</app-type>
<var-menu-select @select="handleSelect">
<var-button type="primary">{{ t('please') }}</var-button>

<template #options>
<var-menu-option :label="t('eat')" />
<var-menu-option :label="t('sleep')" />
<var-menu-option :label="t('play')" />
</template>
</var-menu-select>

<app-type>{{ t('size') }}</app-type>
<var-space align="center" :size="[20, 60]">
<var-menu-select v-model="valueNormal">
Expand Down Expand Up @@ -242,12 +258,12 @@ onThemeChange()
<var-button type="primary">{{ valueSelectOptions ? valueSelectOptions : t('please') }}</var-button>
</var-menu-select>

<app-type>Cascade</app-type>
<app-type>{{ t('cascade') }}</app-type>
<var-menu-select :options="cascadeOptions" v-model="cascadeValue">
<var-button type="primary">{{ cascadeValue ? cascadeValue : t('please') }}</var-button>
</var-menu-select>

<app-type>Cascade Multiple</app-type>
<app-type>{{ t('multipleCascade') }}</app-type>
<var-menu-select multiple :options="cascadeOptions" v-model="cascadeMultipleValue">
<var-button type="primary">{{ cascadeMultipleValue.length ? cascadeMultipleValue : t('please') }}</var-button>
</var-menu-select>
Expand Down
1 change: 1 addition & 0 deletions packages/varlet-ui/src/menu-select/example/locale/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ export default {
closeOnSelect: 'Disable Close On Select',
selectOptions: 'Options API',
selectOptionsWithCustomizedKey: 'Options API (With Customized Key)',
onSelect: 'Select Event',
}
3 changes: 3 additions & 0 deletions packages/varlet-ui/src/menu-select/example/locale/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ export default {
closeOnSelect: '选择选项时禁止关闭菜单',
selectOptions: '选项式 API',
selectOptionsWithCustomizedKey: '选项式 API(自定义字段)',
onSelect: '选中事件',
cascade: '级联单选',
multipleCascade: '级联多选',
}

0 comments on commit 2ba4de6

Please sign in to comment.