1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- //全局随机数重写
- const random = Math.random;
- Math.random = (a = 0, b = 1, c = 6) => {
- return (random() * (b - a) + a).toFixed(c) - 0;
- };
- import Vue from 'vue';
- //全局接口请求
- import $http from "./api/index.js";
- Vue.prototype.$http = $http;
- //管理数据状态
- import store from './script/store';
- Vue.prototype.$store = store;
- //ui框架
- import {
- Image, //图片
- Rate,
- Input,
- InfiniteScroll,
- Button
- } from 'element-ui';
- import 'element-ui/lib/theme-chalk/index.css'
- Vue.use(Image);
- Vue.use(Rate);
- Vue.use(Input);
- Vue.use(InfiniteScroll);
- Vue.use(Button);
- import VueTouch from"vue-touch";
- VueTouch.config.swipe = {direction: 'horizontal' };
- Vue.use(VueTouch, {name:'v-touch'});
- import 'animate.css';
- import './assets/css/main.less';
- //路由
- import router from './script/router';
- import mainTitle from './components/title.vue';
- Vue.component("mainTitle",mainTitle);
- import preview from "./components/preview.vue";
- Vue.component("preview",preview);
- //防止多次触发执行 函数
- Vue.prototype.$timeFun = (time = 500) => {
- let o = null;
- return (fun, t) => {
- clearTimeout(o);
- o = setTimeout(fun, t || time);
- }
- }
- //全局过滤器
- Vue.filter("host",src=>{
- src += "";
- const x = src.slice(0, 1);
- switch (src.slice(0, 7)) {
- case 'http://':
- case 'https:/':
- return src;
- break;
- default:
- return `/mtsy${x == '/' ? '' : '/'}${src}`;
- break;
- }
- });
- Vue.filter("hostList",src=>{
- src += "";
- const x = src.slice(0, 1);
- switch (src.slice(0, 7)) {
- case 'http://':
- case 'https:/':
- return [src];
- break;
- default:
- return [`/mtsy${x == '/' ? '' : '/'}${src}`];
- break;
- }
- });
- import App from './App.vue';
- new Vue({
- router,
- render: h => h(App)
- }).$mount('#app');
|