mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-05 20:58:22 +08:00
fix: to remove vue-router dep (#670)
This commit is contained in:
parent
a2a515024a
commit
857715564b
@ -4,8 +4,7 @@
|
||||
"main": "dist/index.js",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"vue": "^3.0.0",
|
||||
"vue-router": "^4.0.0-beta.4"
|
||||
"vue": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/test-utils": "^2.0.0-beta.3"
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, inject, ref, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
interface IBreadcrumbInject {
|
||||
separator: string
|
||||
@ -38,16 +37,15 @@ export default defineComponent({
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
setup(props: IBreadcrumbItemProps) {
|
||||
setup(props: IBreadcrumbItemProps, ctx) {
|
||||
const link = ref(null)
|
||||
const parent: IBreadcrumbInject = inject('breadcrumb')
|
||||
|
||||
onMounted(() => {
|
||||
link.value.setAttribute('role', 'link')
|
||||
link.value.addEventListener('click', () => {
|
||||
if (!props.to) return
|
||||
const router = useRouter()
|
||||
if (!router) return
|
||||
const router = (ctx as any).$router
|
||||
if (!props.to || !router) return
|
||||
props.replace ? router.replace(props.to) : router.push(props.to)
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user