mescroll 中使用多语言

在接口请求之前,替换中英文 文案。

upCallback(page) {
    
    
	if(this.mescroll){
    
    
		this.mescroll.optDown.textInOffset = this.$t('common1')
		this.mescroll.optDown.textOutOffset = this.$t('common2')
		this.mescroll.optDown.textLoading = this.$t('common3')
		this.mescroll.optDown.textSuccess = this.$t('common4')
		this.mescroll.optDown.textErr = this.$t('common5')
		this.mescroll.optUp.textInOffset = this.$t('common1')
		this.mescroll.optUp.textOutOffset = this.$t('common2')
		this.mescroll.optUp.textLoading = this.$t('common3')
		this.mescroll.optUp.textSuccess = this.$t('common4')
		this.mescroll.optUp.textSuccess = this.$t('common5')
		this.mescroll.optUp.empty.tip = this.$t('common6')
		this.mescroll.optUp.textNoMore = this.$t('common7')
	}
	this.$http.get('/api/swaps', {
    
    
		page_no: page.num,
		page_size:20
	}).then(res => {
    
    
		let arr = res.swaps;
		if (page.num === 1) this.list = [];
		this.list = this.list.concat(arr);
		this.$nextTick(() => {
    
    
			this.mescroll.endSuccess(arr.length)
		})
	}).catch((e) => {
    
    
		this.mescroll.endErr();
	});
},

this.$t('common1')中对应的是中英文的json文件

当切换事件触发时

changeLocale(e){
    
    
	console.log('语言切换了',e);
	this.mescroll.resetUpScroll();
},

猜你喜欢

转载自blog.csdn.net/qq_40745143/article/details/130725347