iter(g58): 新增 affix 固钉组件
This commit is contained in:
@@ -9,6 +9,7 @@ const IMG_DEMO = 'data:image/svg+xml;utf8,' + encodeURIComponent(
|
||||
);
|
||||
import {
|
||||
accordion,
|
||||
affix,
|
||||
alert,
|
||||
autoComplete,
|
||||
avatar,
|
||||
@@ -763,6 +764,19 @@ const content = h(
|
||||
h('span', { class: 'ua-colorpicker-swatch', style: () => `background:${colorVal()}` }),
|
||||
),
|
||||
),
|
||||
section(
|
||||
'sec-affix',
|
||||
'固钉',
|
||||
'affix:内容滚过阈值后转 fixed 贴顶,外层保留占位高度不塌陷;固定后宽度随容器自适应。',
|
||||
h(
|
||||
'div',
|
||||
{ class: 'row' },
|
||||
h('div', { style: 'flex:1;min-height:320px;display:flex;gap:16px' },
|
||||
affix({ offset: 8 }, card({ title: '滚动时我会贴顶' }, h('p', { class: 'desc' }, '向下滚动本页,这块卡片会固定在视口顶部(距顶 8px),左侧占位不会塌。'))),
|
||||
h('div', { class: 'desc', style: 'flex:1' }, '右侧是普通内容,用来撑高这一行,方便观察固钉效果。'.repeat(6)),
|
||||
),
|
||||
),
|
||||
),
|
||||
section(
|
||||
'sec-backtop',
|
||||
'返回顶部',
|
||||
|
||||
Reference in New Issue
Block a user