1 Star 0 Fork 60

Mr不知为何/uni-chat

forked from 野火IM/uni-chat 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.js 2.25 KB
一键复制 编辑 原始数据 按行查看 历史
armXyz 提交于 2022-07-16 22:04 . 会话界面滑动时,隐藏软键盘等
import Vue from 'vue'
import App from './App'
import store from "./store";
import VueI18n from 'vue-i18n'
import {getItem} from "./pages/util/storageHelper";
import Picker from "./common/Picker";
import wfc from "./wfc/client/wfc";
import wfcUIKit from "./wfc/uikit/wfcUIKit";
import Config from "./config";
Vue.config.productionTip = false
App.mpType = 'app'
Vue.use(VueI18n)
Vue.use(Picker)
const i18n = new VueI18n({
// 使用localStorage存储语言状态是为了保证页面刷新之后还是保持原来选择的语言状态
locale: getItem('lang') ? getItem('lang') : 'zh-CN', // 定义默认语言为中文
messages: {
'zh-CN': require('@/assets/lang/zh-CN.json'),
'zh-TW': require('@/assets/lang/zh-TW.json'),
'en': require('@/assets/lang/en.json')
}
})
// 如果不存在会话页面,则入栈,如果已经存在会话页面,则返回到该页面
Vue.prototype.$go2ConversationPage = () => {
let pages = getCurrentPages();
let cvRoute = 'pages/conversation/ConversationView'
let delta = 0;
let found = false;
for (let i = pages.length - 1; i >= 0; i--) {
if (pages[i].route === cvRoute) {
found = true;
break;
} else {
delta++;
}
}
if (found) {
uni.navigateBack({
delta: delta,
fail: err => {
console.log('nav back to conversationView err', err);
}
});
} else {
uni.navigateTo({
url: '/pages/conversation/ConversationView',
success: () => {
console.log('nav to conversationView success');
},
fail: (err) => {
console.log('nav to conversationView err', err);
}
})
}
}
Vue.prototype.$scrollToBottom= () => {
setTimeout(() => {
uni.pageScrollTo({
scrollTop: 999999,
duration: 10
});
app.$forceUpdate()
}, 100);
}
Vue.prototype._i18n = i18n;
const app = new Vue({
i18n,
...App
})
app.store = store;
wfc.init();
if (wfcUIKit.isUIKitEnable()) {
Config.ICE_SERVERS.forEach(iceServer => {
wfcUIKit.addICEServer(iceServer.uri, iceServer.userName, iceServer.password);
})
}
store.init();
app.$mount()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/issuns/uni-chat.git
git@gitee.com:issuns/uni-chat.git
issuns
uni-chat
uni-chat
main

搜索帮助