Commit 7dc6a8c3b49ed4004464c94e54839cb1b8ce5ddb
Committed by
GitHub
Merge pull request #4009 from lison16/anchor
修改showInkInFixed为showInk,如果设为true则永远显示小圆点
Showing
2 changed files
with
3 additions
and
6 deletions
Show diff stats
examples/routers/anchor.vue
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | <div class="link-wrapper"> |
4 | 4 | <Button @click="changeCon">修改为Window</Button> |
5 | 5 | <Button @click="andLink">添加一个连接</Button> |
6 | - <Anchor :bounds="100" @on-change="handleChange" @on-select="handleSelect" :style="{right: '100px'}" :affix="true" :offset-top="30" :scroll-offset="100" :container="scrollCon" show-ink-in-fixed> | |
6 | + <Anchor :bounds="100" @on-change="handleChange" @on-select="handleSelect" :style="{right: '100px'}" :affix="true" :offset-top="30" :scroll-offset="100" :container="scrollCon" show-ink> | |
7 | 7 | <AnchorLink v-if="(link - 1) % 30 === 0" v-for="link in 300" :key="`link${link}`" :href="`#title-${link}`" :title="`title-${link}`"> |
8 | 8 | <AnchorLink :scroll-offset="20" v-if="link === 61" href="#title-child-69" title="title-child-69"/> |
9 | 9 | </AnchorLink> | ... | ... |
src/components/anchor/anchor.vue
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | <div :class="`${prefix}-wrapper`" :style="wrapperStyle"> |
4 | 4 | <div :class="`${prefix}`"> |
5 | 5 | <div :class="`${prefix}-ink`"> |
6 | - <span v-show="showInkBall" :class="`${prefix}-ink-ball`" :style="{top: `${inkTop}px`}"></span> | |
6 | + <span v-show="showInk" :class="`${prefix}-ink-ball`" :style="{top: `${inkTop}px`}"></span> | |
7 | 7 | </div> |
8 | 8 | <slot></slot> |
9 | 9 | </div> |
... | ... | @@ -50,7 +50,7 @@ export default { |
50 | 50 | default: 5 |
51 | 51 | }, |
52 | 52 | container: [String, HTMLElement], |
53 | - showInkInFixed: { | |
53 | + showInk: { | |
54 | 54 | type: Boolean, |
55 | 55 | default: false |
56 | 56 | }, |
... | ... | @@ -70,9 +70,6 @@ export default { |
70 | 70 | }, |
71 | 71 | containerIsWindow () { |
72 | 72 | return this.scrollContainer === window; |
73 | - }, | |
74 | - showInkBall () { | |
75 | - return this.showInkInFixed && (this.isAffixed || (!this.isAffixed && !this.upperFirstTitle && this.scrollContainer !== window)); | |
76 | 73 | } |
77 | 74 | }, |
78 | 75 | methods: { | ... | ... |