mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
feat: use built-in throwError function. (#2131)
* feat: use built-in throwError function. * Update index.vue * Update index.vue
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user