B
B
BonBon Slick2018-11-29 10:54:42
Vue.js
BonBon Slick, 2018-11-29 10:54:42

How to set the value of the lang attribute of an html tag?

How to ask

<!DOCTYPE html>
<html lang="{{ this.$store.getters.lang }}">
<head>

or something like that?
Without Nuxt, vue cli must be declared globally, not for each route individually.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-11-29
@BonBonSlick

watch: {
  '$store.getters.lang': {
    immediate: true,
    handler(val) {
      document.documentElement.setAttribute('lang', val);
    },
  },
},

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question