How to use vue-i18n on data attribute

https://github.com/kazupon/vu.

You can use this in

html

{{ $t("message.hello") }}

so how do you assign it to a variable?

    data () {
        return {
        
          value: "$t("allQuestion")" //

        }
    }
Jun.30,2021

encountered the same method, which has been solved, but I don't know whether it is good or not:
bind data with computed:

// html

 <li v-for="(item, index) in stepLists">
    <img :src="item.img" alt="">
    <div class="img-cover">
        <div class="step-title">{{$t('lang.step')}} {{index + 1}}</div>
        <div class="step-dec">
            {{item.stepDec}}
        </div>
    </div>
</li>


//js
computed: {
    stepLists() {
        return [
            {
                img: require('../assets/img/home/step1_pic.png'),
                stepDec: this.$t('lang.homePage.stepLists[0]')
            },
            {
                img: require('../assets/img/home/step2_pic.png'),
                stepDec: this.$t('lang.homePage.stepLists[1]')
            }
        ]
    }
},

you can use this.$t. As soon as the relevant usage https://github.com/kazupon/vu. has been added to the document, it is estimated that gitbook will be recompiled in a day or two, and then you can go directly to the official documentation website to check it out.

var vm = new Vue({
  data() {
    return {
      a: this.$t('a')
    }
  }
})

example: https://jsfiddle.net/hr2aksy9/6/


how to traverse in data?



https://jsfiddle.net/likaiqia.


doesn't anyone consider computed?

Menu