iter(g83): 开关改 switch 语义并补可访问名
This commit is contained in:
@@ -139,6 +139,7 @@ const name = signal('');
|
||||
// —— 表单控件状态集中声明 ——
|
||||
const agreed = signal(false);
|
||||
const nightMode = signal(true);
|
||||
const sound = signal(true); // 无可见文案的开关演示
|
||||
const city = signal('');
|
||||
const size = signal('m');
|
||||
const bio = signal('');
|
||||
@@ -254,6 +255,7 @@ const content = h(
|
||||
'checkbox / switch / select / radioGroup / textarea:状态一律由调用方信号持有;select 弹层在视口下方空间不足时自动翻到上方,展开后键入字母可快跳选项;textarea 传 maxCount 显示实时字数。',
|
||||
h('div', { class: 'row' }, checkbox({ label: '同意条款', checked: agreed }), h('span', { class: 'out' }, () => (agreed() ? '已同意' : '未同意'))),
|
||||
h('div', { class: 'row' }, switchButton({ label: '夜间模式', checked: nightMode }), h('span', { class: 'out' }, () => (nightMode() ? '开' : '关'))),
|
||||
h('div', { class: 'row' }, switchButton({ checked: sound, ariaLabel: '通知声音' }), h('span', { class: 'out' }, () => `无可见文案的开关(ariaLabel 兜底,读屏念「通知声音」):${sound() ? '开' : '关'}`)),
|
||||
h('div', { class: 'row' }, select({ options: cities.map((c) => ({ value: c, label: c })), value: city, placeholder: '选择城市…' }), h('span', { class: 'out' }, () => (city() ? `城市:${city()}` : '未选择'))),
|
||||
h('div', { class: 'row' }, radioGroup({ options: [{ value: 's', label: '小' }, { value: 'm', label: '中' }, { value: 'l', label: '大' }], value: size })),
|
||||
textarea({ placeholder: '一句话介绍…', value: bio, rows: 2, maxCount: 30 }),
|
||||
|
||||
Reference in New Issue
Block a user