首页 > 解决方案 > 将 v-html 属性与 vue-i18n 标签中的标记结合起来

问题描述

在我的 laravel 5.6/vue.js 2.5.7 / vue-i18n 7.8 我想用 html 标签显示语言标签,比如:

'votes_with_rating'           => 'votes {related_votes_count} with rating `<b>{calc_artist_rating}</b>`',

并在 vue 文件中计算:

...
computed: {

    votes_with_rating_value: function () {
        return this.$tc( 'artist.votes_with_rating', { related_votes_count : this.artist.related_votes_count, calc_artist_rating:
            this.calcArtistRating(this.artist.related_votes_count, this.artist.related_votes_sum, 1)} );
    },
...

但结果与我预期的不同,因为没有呈现数字: https ://imgur.com/a/0rWRTvE 如果不使用

<span v-html

那么输出是有效的......哪个是正确的方法?谢谢!

标签: laravel-5internationalizationvuejs2

解决方案


推荐阅读