c5_labsci/fapp/ciyon_ap/pages/demo/zmixin.js

50 lines
924 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export default {
data() {
return {
locale: 'zh-Hans',
locales: [{
id: 'zh-Hans',
name: '简体中文'
}, {
id: 'zh-Hant',
name: '繁体中文'
}, {
id: 'en',
name: 'English'
}, {
id: 'ja',
name: '日本語'
}],
formdata:'',
props: {},
eventlog: []
};
},
created() {
let lang = uni.getStorageSync("_lang");
if (!lang)
lang = uni.getLocale();
this.locale = lang;
},
methods: {
chglog(event, e) {
console.log(event, e);
if(e.com)
delete e.com;
this.eventlog.unshift(event + ': ' + JSON.stringify(e, null, ' '));
},
submitlog(e) {
console.log(e);
this.formdata = '<b>表单数据: </b>'+JSON.stringify(e.detail.value, null, ' ');
},
callfun(com, fun) {
this.getrefs(com).then(ref => {
console.log(ref[fun]());
});
},
setlocale(locale) {
this.locale = locale;
this.$i18n.locale = locale;
},
}
};