Skip to content
This repository has been archived by the owner on Jun 9, 2019. It is now read-only.

How to use with vue-router #60

Open
dweldon opened this issue May 22, 2017 · 1 comment
Open

How to use with vue-router #60

dweldon opened this issue May 22, 2017 · 1 comment

Comments

@dweldon
Copy link

dweldon commented May 22, 2017

How should one configure vue-play to work with vue-router? It seems like we don't have the option to pass a router instance to preview, so I'm unclear how keep components with <router-link> elements from throwing errors.

@dweldon
Copy link
Author

dweldon commented May 22, 2017

Here's what my play/index.js looks like:

import Vue from 'vue';
import router from '@/router';
import VueRouter from 'vue-router';

// Enable plugins
Vue.use(VueRouter);
Vue.extend().options.router = router;

// Add scenarios
const load = requireContext => requireContext.keys().map(requireContext);
load(require.context('./scenarios', true, /.js$/));

The component renders correctly outside of vue-play. The error I'm getting inside vue-play is:

Error in render function: "TypeError: Cannot read property 'resolve' of undefined"

I'm certain that VueRouter is getting picked up (Vue seems to know what a router-link is), but the routes are not. I assume I'm supposed to be attaching the router in some other way. Ideas?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant