Files
workspace/code/g3soft-libs/docs/examples/segmented/uncontrolled.vue
T
2026-10-08 22:38:34 +08:00

19 lines
520 B
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
// 不传 modelValue 即非受控:组件内部维护选中值,只通过 change 通知
import { ref } from 'vue'
import { G3Segmented } from '@g3soft/ui'
const current = ref('hot')
function onChange(value: string | number | boolean) {
current.value = String(value)
}
</script>
<template>
<div>
<G3Segmented :options="['hot', 'new', 'top']" @change="onChange" />
<p style="margin: 8px 0 0; font-size: 13px; color: #6b7280">change 收到:{{ current }}</p>
</div>
</template>