opened
timdiacon
username_0
I've created a plugin for my link resolver, included it in the nuxt.config and passed it to Prismic-Vue. If I use <prismic-link> in my template I can see that it's using the link-resolver on the :field attribute, but when I use a <nuxt-link> the link-resolver doesn't seem to get used on the :to attribute which I would expect.

If the link-resolver doesn't work on the <nuxt-link> and that is how all links should be included in templates I'm not sure what the purpose of passing the link-resolver to Prismic-Vue is?

Have I misunderstood something?
nuxt-link not using link-resolver
issue
created
hypervillain
username_1
Hello @username_0,

as we discussed elsewhere, there may be different things at stake here, mostly because we're making changes to multiple projects at once, that are not fully documented yet. Let me recap what is going to happen first, and how to solve your issue then:

First, we'll be shutting down the Nuxt branch of this repository, in profit of an official Nuxt module (https://github.com/nuxt/prismic). This should be done by the end of the week. Once declared in your Nuxt config, it will extend Vue's prototype by itself (a bit like it's done in the `install` method of prismic-vue (see [this portion of code](https://github.com/prismicio/prismic-vue/blob/master/src/index.js)) and register the components that need to be registered. It means that you will be able to get rid of all prismic-vue related calls and plugins. Using `<prismic-link :field="field" />` will work as expected and populate the `:to` field accordingly.

But because the prismic-vue plugin has been updated before prismic-nuxt, you currently are in a situation where the Vue components expect things that aren't there. Before updating to prismic-nuxt, what you can do is to follow [_this part_](https://github.com/prismicio/prismic-vue#integrate-prismic-vue-components) of the documentation, and update as soon as the official module is here.

This way, both these calls will work for you:
```html
<!-- Internally, this will call your linkResolver -->
<prismic-link :field="field" />
<!-- Or call it explicitly -->
<nuxt-link :to="$prismic.linkResolver(field)" />
````

To sum things up, the prismic-vue library now holds two very different things:
- a Vue plugin, that extends Vue, expects plugins and registers components
- a set of components that can be used independently of the module (eg. by prismic-nuxt module)

If you use Nuxt: wait 2-3 days, declare the prismic-nuxt module in your Nuxt config and you're good to go. If you use Vue only, you can keep following the README

Let me know if it helps ✌️
comment
created
colinmollenhour
username_2
Hi @username_1 the nuxt/prismic repo is 404.. Do you have an update on this? Thanks!
comment
created
haversnail
username_3
@username_2 https://github.com/nuxt-community/prismic-module
comment
created
hypervillain
username_1
Yes, thanks @username_3, we're moving the Nuxt part of Prismic to an official NuxtJS module, built by the Nuxt community. No official release yet, sorry you have to find it via a Github issue..
comment
created
colinmollenhour
username_2
No problem, I understand getting things organized and published takes time. Keep up the great work!
comment
created
hypervillain
username_1
Thanks a lot! Expect an update in documentation in the coming days
comment
closed
hypervillain
username_1
issue
created
timdiacon
username_0
Hey @username_1 so I've finally updated my code to use the module which is great. I'm using the `<prismic-link>` which I can confirm is correctly calling my link resolver. The problem I have is that I am using i18n and I need to call the method `app.localePath` but app is not available within the linkResolver method.

I can work around this by making my linkResolver available globally by extending Vue.prototype and then calling it manually from my templates

`export default ({ app }) => {
	Vue.prototype.$linkResolver = function(doc, parent) {
         // app.locale() used here
	}
}`

But what I really want to do is be able to use the `<prismic-link>` tag. I'm wondering if it would be possible for that component to pass the context to the linkresolver method along with the doc?
comment