背景:
1、因为中英文语序的问题,很多文字不能直接通过中式的拼接直接完成,例如‘还可以输入**个字’。
2、在完成输入参数后,参数的样式是需要定制样式的,但怎么实现呢?

解决方法:
1、在国际化文件中输入

'tip': '还可以输入{0}字'

2、在vue中的script使用

 this.$t(`main.common.tip`, [this.maxInputLength - this.inputValue.length])

3、定制样式方式

<i18n path="main.common.tip" tag="span">
    <span class="length-tip">{{[this.maxInputLength - this.inputValue.length}}</span>
</i18n>

效果:
展示效果

Logo

前往低代码交流专区

更多推荐