Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSR custom directive not working with router-link. #1

Closed
DaxChen opened this issue Feb 4, 2018 · 3 comments
Closed

SSR custom directive not working with router-link. #1

DaxChen opened this issue Feb 4, 2018 · 3 comments

Comments

@DaxChen
Copy link

DaxChen commented Feb 4, 2018

vue & vue-i18n version

vue@2.5.13 (with nuxt@1.3.0)
vue-i18n@7.4.2
vue-i18n-extension@0.1.0

Reproduction Link

Online Demo
Github Repo

Steps to reproduce

Open the online demo link:

  1. refresh without cache (command-shift-R on mac) and see that {{ $t('xxx') }} shows immediately (SSR) but v-t="'xxx'" shows a bit later (no SSR)
  2. Right-click and "View page source", and you can see this:
<router-link class="curly_bracket">{{ $t('curly_bracket') }}</router-link>
<router-link class="directive" v-t="'directive'" />

renders to:

<a class="curly_bracket">Using {{ }}, shows in SSR!</a>
<a class="directive"></a>

Only {{ $t() }} is server side rendered, v-t="'xxx" isn't.

This SSR directive works with primitive html tags, but when using with vue components such as <router-link>, it fails.

What is Expected?

v-t directive on <router-link> to work with SSR

What is actually happening?

v-t directive only works with primitive html elements, but not with vue components such as <router-link>.

Thank you so much!

@kazupon
Copy link
Member

kazupon commented Aug 11, 2018

Hmm 🤔 , I seem same the below issue:
vuejs/vue#5239

@kazupon
Copy link
Member

kazupon commented Aug 11, 2018

Maybe, custom directive doesn't not support for components on SSR.
However, functional component work on SSR.

@kazupon kazupon closed this as completed Feb 9, 2021
@kazupon
Copy link
Member

kazupon commented Feb 9, 2021

close (in-activity)

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

No branches or pull requests

2 participants