| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- import Vue from 'vue'
- import VueMeta from 'vue-meta'
- import App from './App.vue'
- import router from './router'
- import store from './store'
- Vue.use(VueMeta, {
- refreshOnceOnNavigation: true
- })
- // 移动端适配 - flexible
- import 'lib-flexible'
- // Vant UI组件(按需引入在具体组件中)
- import './plugins/vant'
- // 全局样式
- import './assets/styles/index.scss'
- // 动画库
- import 'animate.css'
- // axios
- import request, {
- baseUrl
- } from './utils/request'
- Vue.prototype.$axios = request
- Vue.prototype.$baseUrl = baseUrl
- // 全局配置
- Vue.config.productionTip = false
- // 全局方法
- Vue.prototype.$scrollToTop = function() {
- window.scrollTo({
- top: 0,
- behavior: 'smooth'
- })
- }
- // 防抖函数
- Vue.prototype.$debounce = function(fn, delay = 300) {
- let timer = null
- return function(...args) {
- if (timer) clearTimeout(timer)
- timer = setTimeout(() => {
- fn.apply(this, args)
- }, delay)
- }
- }
- // 节流函数
- Vue.prototype.$throttle = function(fn, delay = 300) {
- let lastTime = 0
- return function(...args) {
- const now = Date.now()
- if (now - lastTime > delay) {
- fn.apply(this, args)
- lastTime = now
- }
- }
- }
- import {
- Locale
- } from 'vant-green';
- import zhCN from 'vant-green/lib/locale/lang/zh-CN';
- Locale.use('zh-CN', zhCN);
- new Vue({
- router,
- store,
- render: h => h(App)
- }).$mount('#app')
|