13 Star 128 Fork 28

乔永刚 / AI创作系统cahtgpt聊天系统小程序PC端

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.js 1.48 KB
一键复制 编辑 原始数据 按行查看 历史
qiaoyonggang 提交于 2023-05-13 09:42 . init初始化代码
import App from './App'
// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
App.mpType = 'app'
import uView from '@/uview-ui'
Vue.use(uView)
import request from 'common/request/index.js'
Vue.prototype.$request = request
import utils from '@/common/utils/index.js'
Vue.prototype.$utils = utils
import { BASE_URL, WSS_URL } from './env.js'
Vue.prototype.$BASE_URL = BASE_URL
Vue.prototype.$WSS_URL = WSS_URL
Vue.mixin({
data() {
return {
}
},
onLoad() {
// #ifdef MP-WEIXIN
wx.showShareMenu({
withShareTicket: false,
menus: ["shareAppMessage", "shareTimeline"]
})
// #endif
},
onShow() {
},
onReady() {
},
beforeDestroy() {
},
methods: {
}
})
try {
function isPromise(obj) {
return (
!!obj &&
(typeof obj === "object" || typeof obj === "function") &&
typeof obj.then === "function"
);
}
// 统一 vue2 API Promise 化返回格式与 vue3 保持一致
uni.addInterceptor({
returnValue(res) {
if (!isPromise(res)) {
return res;
}
return new Promise((resolve, reject) => {
res.then((res) => {
if (res[0]) {
reject(res[0]);
} else {
resolve(res[1]);
}
});
});
},
});
} catch (error) {}
const app = new Vue({
...App
})
app.$mount()
// #endif
// #ifdef VUE3
import {
createSSRApp
} from 'vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
// #endif
PHP
1
https://gitee.com/qiao-yonggang/uniapp-fastadmin-chatgpt.git
git@gitee.com:qiao-yonggang/uniapp-fastadmin-chatgpt.git
qiao-yonggang
uniapp-fastadmin-chatgpt
AI创作系统cahtgpt聊天系统小程序PC端
master

搜索帮助