32632e796e
Change-Id: I76d0f72679cd75085f5ffd42f641daa198cafe11 docs: update docs for alert/autocomplete/carousel, etc. Change-Id: Ib7507f4979024f53c127e4b64b88560b93999db7 fix: update for autocomplete filter Change-Id: Ie54556715fa52838aeb6caaa19b4f9a9f14b490f docs: add docs for calendar/transfer/cascader Change-Id: I655b3cb3d25dd0649de9ae7e224e7063a40dd079 fix: add more demos for input/textarea Change-Id: Iada527ca82643a435a4775110b332155512d62a7 docs: add docs for uploader,select,table, etc. Change-Id: Ib034fd5cc9d9a420d4e002956ae925175783c5f3 docs: adjust formatting and punc. docs: adjust docs for uploader, etc. Change-Id: If06c8c1102eafce43f5802a333676fc9e62cd474 docs: add docs for nav Change-Id: If56a653ec53f19239606128fd30cae80f8e10025 docs: improve anchor demos Change-Id: I6ac1c08cc8905924d0062def1f8921fe1f302f15 docs: refine wording and format docs: update docs for check-button-group desc Change-Id: Ica7d6d0692250f0be6bd330b1ad4cc41938afd46
145 lines
2.5 KiB
Vue
145 lines
2.5 KiB
Vue
<template>
|
||
<article class="anchor-offset-demo">
|
||
<div class="target-offset-line"/>
|
||
<div class="sticky-offset-line"/>
|
||
<div
|
||
ref="container"
|
||
class="anchor-wrapper"
|
||
>
|
||
<div
|
||
v-for="i in coffees"
|
||
:id="i.value.indexOf('#') >= 0 ? i.value.slice(1) : i.value"
|
||
:key="i.value"
|
||
class="block"
|
||
>
|
||
{{ i.label }}
|
||
</div>
|
||
<section class="anchor-two">
|
||
<h3>吸附锚点</h3>
|
||
<veui-anchor
|
||
:items="coffees"
|
||
target-offset="20px"
|
||
sticky-offset="30px"
|
||
container="container"
|
||
/>
|
||
</section>
|
||
</div>
|
||
</article>
|
||
</template>
|
||
|
||
<script>
|
||
import { Anchor } from 'veui'
|
||
|
||
export default {
|
||
components: {
|
||
'veui-anchor': Anchor
|
||
},
|
||
data () {
|
||
return {
|
||
coffees: [
|
||
{
|
||
label: 'Infused',
|
||
value: '#infused1',
|
||
children: [
|
||
{
|
||
label: 'Breadcrumb',
|
||
value: '/components/breadcrumb'
|
||
}
|
||
]
|
||
},
|
||
{
|
||
label: 'Boiled',
|
||
value: '#boiled1',
|
||
children: [
|
||
{
|
||
label: 'Button',
|
||
value: '/components/button'
|
||
}
|
||
]
|
||
},
|
||
{
|
||
label: 'Espresso',
|
||
value: '#espresso1'
|
||
},
|
||
{
|
||
label: 'Milk coffee',
|
||
value: '#milk-coffee1'
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="less" scoped>
|
||
.anchor-offset-demo {
|
||
position: relative;
|
||
|
||
.sticky-offset-line,
|
||
.target-offset-line {
|
||
position: absolute;
|
||
top: 20px;
|
||
width: 180px;
|
||
border-top: 1px solid red;
|
||
|
||
&::after {
|
||
content: "targetOffset(切换于此)";
|
||
position: absolute;
|
||
right: 0;
|
||
bottom: 0;
|
||
color: red;
|
||
font-size: 12px;
|
||
}
|
||
}
|
||
|
||
.sticky-offset-line {
|
||
top: 30px;
|
||
left: 250px;
|
||
|
||
&::after {
|
||
content: "stickyOffset(吸附于此)";
|
||
}
|
||
}
|
||
|
||
.anchor-wrapper {
|
||
position: relative;
|
||
display: flex;
|
||
flex-direction: column;
|
||
height: 300px;
|
||
overflow: auto;
|
||
border: 1px dashed;
|
||
|
||
& > section {
|
||
position: absolute;
|
||
}
|
||
}
|
||
|
||
.block {
|
||
white-space: nowrap;
|
||
border-top: 1px solid #000;
|
||
width: 100px;
|
||
height: 150px;
|
||
flex: none;
|
||
|
||
& + .block {
|
||
margin-top: 20px;
|
||
}
|
||
}
|
||
|
||
.anchor-two {
|
||
position: absolute;
|
||
left: 250px;
|
||
top: 50px;
|
||
}
|
||
}
|
||
|
||
</style>
|
||
|
||
<docs>
|
||
虚线框标记容器,黑实线标记锚点项顶部。
|
||
|
||
当黑实线和 `tagetOffset` 线重合触发激活。
|
||
|
||
`Anchor` 吸附在 `stickyOffset` 线处。
|
||
</docs>
|