iter(g29): 新增 carousel 轮播组件
This commit is contained in:
@@ -26,6 +26,7 @@ import {
|
||||
formItem,
|
||||
inputNumber,
|
||||
list,
|
||||
carousel,
|
||||
menu,
|
||||
modal,
|
||||
pagination,
|
||||
@@ -174,6 +175,7 @@ const tableLoading = signal(false);
|
||||
// —— 菜单选中结果:演示 onSelect 回调 ——
|
||||
const menuPick = signal('');
|
||||
const listPick = signal(''); // 列表点击选中的条目标题
|
||||
const slideIndex = signal(0); // 轮播当前下标(外部受控演示)
|
||||
|
||||
// —— 禁用态演示:开关信号同时绑定 switch 的 checked 与 checkbox 的 disabled ——
|
||||
const locked = signal(true);
|
||||
@@ -596,6 +598,27 @@ const content = h(
|
||||
),
|
||||
),
|
||||
),
|
||||
section(
|
||||
'sec-carousel',
|
||||
'轮播',
|
||||
'carousel:items 横排位移,指示点 / 箭头 / ←→ 键切换,autoplay 毫秒自动前进且悬停暂停;index 传信号即可外部受控。',
|
||||
h(
|
||||
'div',
|
||||
{ class: 'row' },
|
||||
carousel({
|
||||
height: 150,
|
||||
autoplay: 4000,
|
||||
index: slideIndex,
|
||||
onChange: (i) => slideIndex(i),
|
||||
items: [
|
||||
h('div', { style: 'flex:1;display:flex;align-items:center;justify-content:center;height:100%;font-size:15px;background:var(--ua-color-surface);color:var(--ua-color-text)' }, '① 令牌驱动的幻灯片 —— 悬停自动暂停'),
|
||||
h('div', { style: 'flex:1;display:flex;align-items:center;justify-content:center;height:100%;font-size:15px;background:color-mix(in srgb, var(--ua-color-accent) 12%, transparent);color:var(--ua-color-text)' }, '② 指示点与箭头均可点击,←→ 也能切'),
|
||||
h('div', { style: 'flex:1;display:flex;align-items:center;justify-content:center;height:100%;font-size:15px;background:color-mix(in srgb, var(--ua-color-success) 14%, transparent);color:var(--ua-color-text)' }, '③ 环形回绕:末张的下一张回到首张'),
|
||||
],
|
||||
}),
|
||||
h('span', { class: 'out' }, () => `第 ${slideIndex() + 1} / 3 张`),
|
||||
),
|
||||
),
|
||||
section(
|
||||
'sec-menu',
|
||||
'下拉菜单',
|
||||
|
||||
Reference in New Issue
Block a user