fix: back-top trigger two click event

pull/2682/head
tangjinzhou 2020-07-25 21:57:06 +08:00
parent 792d2af69b
commit 4d7cac609c
1 changed files with 5 additions and 2 deletions

View File

@ -1,4 +1,5 @@
import { inject, Transition } from 'vue'; import { inject, Transition } from 'vue';
import classNames from 'classnames';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import backTopTypes from './backTopTypes'; import backTopTypes from './backTopTypes';
import addEventListener from '../vc-util/Dom/addEventListener'; import addEventListener from '../vc-util/Dom/addEventListener';
@ -16,6 +17,7 @@ const props = backTopTypes();
const BackTop = { const BackTop = {
name: 'ABackTop', name: 'ABackTop',
inheritAttrs: false,
mixins: [BaseMixin], mixins: [BaseMixin],
props: { props: {
...props, ...props,
@ -77,15 +79,16 @@ const BackTop = {
const getPrefixCls = this.configProvider.getPrefixCls; const getPrefixCls = this.configProvider.getPrefixCls;
const prefixCls = getPrefixCls('back-top', customizePrefixCls); const prefixCls = getPrefixCls('back-top', customizePrefixCls);
const classString = classNames(prefixCls, this.$attrs.class);
const defaultElement = ( const defaultElement = (
<div class={`${prefixCls}-content`}> <div class={`${prefixCls}-content`}>
<div class={`${prefixCls}-icon`} /> <div class={`${prefixCls}-icon`} />
</div> </div>
); );
const divProps = { const divProps = {
...this.$attrs,
onClick: this.scrollToTop, onClick: this.scrollToTop,
class: prefixCls, class: classString,
}; };
const backTopBtn = this.visible ? ( const backTopBtn = this.visible ? (