vuecssuiant-designantdreactantantd-vueenterprisefrontendui-designvue-antdvue-antd-uivue3vuecomponent
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.1 KiB
59 lines
1.1 KiB
<docs> |
|
--- |
|
order: 4 |
|
title: |
|
zh-CN: 设置锚点滚动偏移量 |
|
en-US: Set Anchor scroll offset |
|
--- |
|
|
|
## zh-CN |
|
|
|
锚点目标滚动到屏幕正中间。 |
|
|
|
## en-US |
|
|
|
Anchor target scroll to screen center. |
|
</docs> |
|
|
|
<template> |
|
<a-anchor |
|
:target-offset="targetOffset" |
|
:items="[ |
|
{ |
|
key: '1', |
|
href: '#components-anchor-demo-basic', |
|
title: 'Basic demo', |
|
}, |
|
{ |
|
key: '2', |
|
href: '#components-anchor-demo-static', |
|
title: 'Static demo', |
|
}, |
|
{ |
|
key: '3', |
|
href: '#api', |
|
title: 'API', |
|
children: [ |
|
{ |
|
key: '4', |
|
href: '#anchor-props', |
|
title: 'Anchor Props', |
|
}, |
|
{ |
|
key: '5', |
|
href: '#link-props', |
|
title: 'Link Props', |
|
}, |
|
], |
|
}, |
|
]" |
|
></a-anchor> |
|
</template> |
|
|
|
<script lang="ts" setup> |
|
import { onMounted, ref } from 'vue'; |
|
const targetOffset = ref<number | undefined>(undefined); |
|
onMounted(() => { |
|
targetOffset.value = window.innerHeight / 2; |
|
}); |
|
</script>
|
|
|