123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- import App from './App'
- import Vue from 'vue'
- import uView from 'uview-ui';
- import common from "@/config/common.js";
- import store from '@/store/index.js'
- import en from '@/static/locales/en.js';
- import hi from '@/static/locales/hi.js';
- // #ifndef VUE3
- // main.js,注意要在use方法之后执行
- import jquery from 'jquery'
- import Videojs from 'video.js'
- import 'video.js/dist/video-js.css'
- // import 'video.js/dist/video-js.min.css'
- // import VueMatomo from 'vue-matomo'
- Vue.config.productionTip = false
- App.mpType = 'app';
-
- // import render from "@/pages/components/render";
- // Vue.prototype.$r = render;
-
- // ...
- // let routes = getCurrentPages()
- // Vue.use(VueMatomo, {
- // host: 'https://onecric.piwik.pro', // 这里配置你自己的piwik服务器地址和网站ID
- // siteId: 'fe5a55b8-bec8-4022-ab0c-b327e32cdf82',//siteId值
- // // 注册名称 =>this.$matomo
- // trackerFileName: 'matomo',
- // // 根据router自动注册
- // router: routes,
- // // // 是否需要在发送追踪信息之前请求许可
- // // // 默认false
- // requireConsent: false,
- // enableLinkTracking: true,
- // // // 是否追踪初始页面
- // // // 默认true
- // trackInitialView: false,
- // // // 最终的追踪js文件名
- // // // 默认 'piwik'
- // trackerFileName: 'piwik',
- // debug: false
- // });
- // 引入并使用vue-i18n
- import VueI18n from 'vue-i18n'
- Vue.use(VueI18n)
- // Vue.use(uView)
- Vue.prototype.$store = store;
- Vue.prototype.$video = Videojs; //使用video.js时用$video
- Vue.prototype.$toUrl = function navigateTo(url){
- uni.navigateTo({
- url:url
- })
- }
- Vue.prototype.$back = function back(num){
- uni.navigateBack({
- delta:num || 1
- })
- }
-
- Vue.prototype.$toast = function toast(title){
- uni.showToast({
- title: title,
- icon: 'error'
- });
- }
-
- Vue.prototype.$ = jquery
- // 如此配置即可
- uni.$u.config.unit = 'rpx'
- // 构造i18n对象
- const i18n = new VueI18n({
- // 默认语言,这里的local属性,对应message中的zh、en属性
- locale: 'en',
- // 引入语言文件
- messages: {
- // 这里的属性名是任意的,您也可以把zh设置为cn等,只是后续切换语言时
- // 要标识这里的语言属性,如:this.$i18n.locale = zh|en|zh|xxx
- //'zh': zh, // 这里为上面通过import引入的语言包
- 'en': en,
- 'hi': hi,
- }
- })
- // 由于微信小程序的运行机制问题,需声明如下一行,H5和APP非必填
- Vue.prototype._i18n = i18n;
- Vue.prototype.$common = common;
- const app = new Vue({
- i18n,
- ...App
- })
- // 引入请求封装,将app参数传递到配置中
- require('./config/request.js')(app)
- app.$mount()
- // #endif
- // #ifdef VUE3
- import { createSSRApp } from 'vue'
- export function createApp() {
- const app = createSSRApp(App)
- return {
- app
- }
- }
- // #endif
|