From 2f8a5799672fb33a5e4f39d406f191244d1b14db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=A2=E6=AF=94=E5=B0=8F=E9=87=91=E5=88=9A?= <2890636389@qq.com> Date: Thu, 3 Jun 2021 12:56:52 +0800 Subject: [PATCH] feat: use built-in throwError function. (#2131) * feat: use built-in throwError function. * Update index.vue * Update index.vue --- packages/backtop/src/index.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/backtop/src/index.vue b/packages/backtop/src/index.vue index 4a30d0ac24..ee79d22cc6 100644 --- a/packages/backtop/src/index.vue +++ b/packages/backtop/src/index.vue @@ -21,6 +21,7 @@ import { defineComponent, ref, computed, onMounted, onBeforeUnmount } from 'vue' import throttle from 'lodash/throttle' import { on, off } from '@element-plus/utils/dom' import { easeInOutCubic } from '@element-plus/utils/animation' +import throwError from '@element-plus/utils/error' interface IElBacktopProps { visibilityHeight: number @@ -56,6 +57,7 @@ export default defineComponent({ const visible = ref(false) const styleBottom = computed(() => `${props.bottom}px`) const styleRight = computed(() => `${props.right}px`) + const scope = 'ElBackTop' const scrollToTop = () => { const beginTime = Date.now() @@ -88,7 +90,7 @@ export default defineComponent({ if (props.target) { el.value = document.querySelector(props.target) if (!el.value) { - throw new Error(`target is not existed: ${props.target}`) + throwError(scope, `target is not existed: ${props.target}`) } container.value = el.value }