Skip to content

Failed to resolve component: RouterLink #162

@EngHell

Description

@EngHell

Versions

  • 2.0

Describe the bug

When providing a template containing router-link the component fails to solve with the next message:

[Vue warn]: Failed to resolve component: RouterLink 
  at <ToastSuccessAddForm key=1 toast-id=0 resourceId=1  ... > 
  at <VtToast key=0 eventBus= 
Object { allHandlers: {} }
 position="top-right"  ... > 
  at <TransitionGroup tag="div" enter-active-class="Vue-Toastification__bounce-enter-active" move-class="Vue-Toastification__bounce-move"  ... > 
  at <VtTransition transition="Vue-Toastification__bounce" class="Vue-Toastification__container top-right" > 
  at <VueToastification eventBus= 
Object { allHandlers: {} }
 >

Expected behavior

What should happen is, that a toast with a router link is created but instead it is not.

Steps to reproduce

  1. Create a component containing router-link, can be with a render function or template both fail for example.
    Component.vue
<script lang="ts">
import { defineComponent, h, resolveComponent } from 'vue'

export default defineComponent({
	props: {
		resource: {
			type: String,
			required: true,
		},
		resourceId: {
			type: Number,
			required: true,
		},
	},
	setup(_) {
		return () =>
			h('div', [
				`${_.resource} was succesfully created. `,
				h(
					resolveComponent('RouterLink'),
					{
						to: {
							name: 'users.update',
							params: { id: _.resourceId },
						},
					},
					() => ['Click here to review'],
				),
			])
	},
})
</script>
  1. Second use this component as content for Toast.success or any variant.
    app.js
import MyComponent from "./Component.vue"
....
const component = {
				component: MyComponent
			}
toast.success(component, { timeout: false })

Your Environment

-vite: 2.0.0-beta34
-vue:3.0.5(@next)
-vue-router:4.0.3 (@next)

Additional context

This component renders fine as you can see in the next screen shot at the bottom you can see its complete, (despite the fact theres no underline in the link due to css)
imagen

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: DiscussionGeneral discussion about project and related subjects

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions