fix: anchor provide not work
parent
c0adff7695
commit
8b4c55c75f
|
@ -1,4 +1,4 @@
|
||||||
import { inject } from 'vue';
|
import { inject, provide } from 'vue';
|
||||||
import PropTypes from '../_util/vue-types';
|
import PropTypes from '../_util/vue-types';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import addEventListener from '../vc-util/Dom/addEventListener';
|
import addEventListener from '../vc-util/Dom/addEventListener';
|
||||||
|
@ -99,11 +99,6 @@ export default {
|
||||||
showInkInFixed: false,
|
showInkInFixed: false,
|
||||||
getContainer: getDefaultContainer,
|
getContainer: getDefaultContainer,
|
||||||
}),
|
}),
|
||||||
setup() {
|
|
||||||
return {
|
|
||||||
configProvider: inject('configProvider', ConfigConsumerProps),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
this.links = [];
|
this.links = [];
|
||||||
this._sPrefixCls = '';
|
this._sPrefixCls = '';
|
||||||
|
@ -111,9 +106,8 @@ export default {
|
||||||
activeLink: null,
|
activeLink: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
provide() {
|
created() {
|
||||||
return {
|
provide('antAnchor', {
|
||||||
antAnchor: {
|
|
||||||
registerLink: link => {
|
registerLink: link => {
|
||||||
if (!this.links.includes(link)) {
|
if (!this.links.includes(link)) {
|
||||||
this.links.push(link);
|
this.links.push(link);
|
||||||
|
@ -127,11 +121,14 @@ export default {
|
||||||
},
|
},
|
||||||
$data: this.$data,
|
$data: this.$data,
|
||||||
scrollTo: this.handleScrollTo,
|
scrollTo: this.handleScrollTo,
|
||||||
|
});
|
||||||
|
provide('antAnchorContext', this);
|
||||||
},
|
},
|
||||||
antAnchorContext: this,
|
setup() {
|
||||||
|
return {
|
||||||
|
configProvider: inject('configProvider', ConfigConsumerProps),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
const { getContainer } = this;
|
const { getContainer } = this;
|
||||||
|
|
Loading…
Reference in New Issue