| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- import Vue from 'vue';
- import App from './App';
- //引入uView框架
- import uView from '@/uni_modules/uview-ui/index'
- Vue.use(uView)
- import cuCustom from '@/public/colorui/components/cu-custom.vue'
- Vue.component('cu-custom', cuCustom)
- /* 自定义图片和文件上传组件 */
- import FileUpload from '@/components/file-upload/index.vue'
- Vue.component('file-upload', FileUpload)
- /* 自定义Tabbar组件 */
- import customTabbar from '@/components/custom-tabbar/index.vue'
- Vue.component('custom-tabbar', customTabbar)
- /* 自定义头部背景块组件 */
- import customTopHeader from '@/components/custom-top-header/index.vue'
- Vue.component('custom-top-header', customTopHeader)
- import '@/public/uni-extend/index.js';
- //引入config文件
- import config from '@/config/env';
- Vue.prototype.$config = config
- //引入API请求
- import api from '@/utils/api.js';
- Vue.prototype.$api = api
- //引入Utils类库
- import util from '@/utils/util.js';
- Vue.prototype.$util = util
- //时间日期js处理库
- import moment from '@/public/moment/moment.js'
- Vue.prototype.$moment = moment
- //JS Linq插件
- // import Enumerable from './public/linq-js/linq-js.min.js'
- // Enumerable.config.as = 'em';
- //引入自定义字典扩展
- import '@/public/dict-extend/index.js';
- //自定义Log打印插件
- import '@/utils/debugger.js';
- //移动端调试插件
- // import VConsole from 'vconsole';
- // 或者使用配置参数来初始化,详情见文档
- // const vConsole = new VConsole({ theme: 'dark' });
- Vue.config.productionTip = false;
- // #ifdef H5
- // 路由API: http://hhyang.cn/src/router/start/quickstart.html
- import Router, {RouterMount} from 'uni-simple-router';
- Vue.use(Router)
- //初始化
- const router = new Router({
- encodeURI: false, //不编码传输
- routes: ROUTES //路由表
- });
- //
- router.afterEach((to, from) => {// 页面跳转后做的处理操作
- if (history) {
- let query = to.query
- delete query.detail
- //H5会自动给每个跳转url自动加上tenant_id、app_id,以便链接的复制
- if (!query.tenant_id) {
- query.tenant_id = App.globalData.tenantId
- }
- if (!query.app_id) {
- query.app_id = App.globalData.appId
- }
- if (!query.component_appid) {
- query.component_appid = App.globalData.componentAppId
- }
- // 记录进入app时的url
- if (typeof window.entryUrl === 'undefined' || window.entryUrl === '') {
- window.entryUrl = location.href.split('#')[0]
- }
- var ary = [];
- for (var p in query) {
- if (query.hasOwnProperty(p) && query[p]) {
- ary.push(encodeURIComponent(p) + '=' + encodeURIComponent(query[p]));
- }
- }
- if (ary.length > 0) {
- let url = "?" + ary.join('&');
- // history.replaceState(null, null, url);//替换页面显示url
- setTimeout(() => {
- history.replaceState(history.state, null, url); // uni-simple-router 组件中应该做了什么处理操作,这里延迟替换路由页面
- }, 100);
- }
- }
- })
- import 'utils/ican-H5Api';// 对齐H5的部分API,保持API通用跨平台;文档:https://ext.dcloud.net.cn/plugin?id=415
- // #endif
- Vue.config.productionTip = false;
- App.mpType = 'app';
- const app = new Vue({
- ...App
- });
- //v1.3.5起 H5端 你应该去除原有的app.$mount();使用路由自带的渲染方式
- // #ifdef H5
- RouterMount(app, '#app');
- // #endif
- // #ifndef H5
- app.$mount(); //为了兼容小程序及app端必须这样写才有效果
- // #endif
|