43513f70
zhigang.li
add anchor component
|
1
2
|
<template>
<div :class="anchorLinkClasses">
|
3fe51bfc
梁灏
update Anchor
|
3
|
<a :class="linkTitleClasses" :href="href" :data-href="href" @click.prevent="goAnchor" :title="title">{{ title }}</a>
|
43513f70
zhigang.li
add anchor component
|
4
5
6
7
|
<slot></slot>
</div>
</template>
<script>
|
576329cc
zhigang.li
use link.js for a...
|
8
|
import mixinsLink from '../../mixins/link';
|
43513f70
zhigang.li
add anchor component
|
9
10
|
export default {
name: 'AnchorLink',
|
c69f8ff5
梁灏
update Anchor
|
11
|
inject: ['anchorCom'],
|
576329cc
zhigang.li
use link.js for a...
|
12
|
mixins: [ mixinsLink ],
|
43513f70
zhigang.li
add anchor component
|
13
14
15
16
17
18
19
20
21
22
23
24
25
|
props: {
href: String,
title: String
},
data () {
return {
prefix: 'ivu-anchor-link'
};
},
computed: {
anchorLinkClasses () {
return [
this.prefix,
|
c69f8ff5
梁灏
update Anchor
|
26
|
this.anchorCom.currentLink === this.href ? `${this.prefix}-active` : ''
|
43513f70
zhigang.li
add anchor component
|
27
28
29
30
31
32
|
];
},
linkTitleClasses () {
return [
`${this.prefix}-title`
];
|
43513f70
zhigang.li
add anchor component
|
33
34
35
|
}
},
methods: {
|
576329cc
zhigang.li
use link.js for a...
|
36
37
38
39
|
goAnchor (event) {
this.currentLink = this.href;
this.$emit('on-select', this.href);
this.handleCheckClick(event);
|
43513f70
zhigang.li
add anchor component
|
40
|
}
|
4556cfa8
zhigang.li
fixed bug of anch...
|
41
42
43
|
},
mounted () {
this.$nextTick(() => {
|
c69f8ff5
梁灏
update Anchor
|
44
|
this.anchorCom.init();
|
4556cfa8
zhigang.li
fixed bug of anch...
|
45
|
});
|
43513f70
zhigang.li
add anchor component
|
46
47
48
|
}
};
</script>
|