import Vue from 'vue'
import App from './App'
// 引入全局存储
import store from './store'
// 引入全局配置
import $mAssetsPath from '@/config/assets.config.js';
import $mConfig from '@/config/global.config.js';
// 引入全局方法
import { http } from '@/common/request';
import $mUtil from '@/common/util.js';
// 全局组件
import navbar from '@/components/hx-navbar/hx-navbar.nvue';	
import ldLoading from '@/components/ld-loading/index.vue';
import nodata from '@/components/noData/nodata.vue';
import loadMore from '@/components/uni-load-more/uni-load-more.vue';
import Directives from './directives/index.js';

// 网络状态监听
// uni.getNetworkType({
// 	success: res => {
// 		console.log(res)
// 		store.dispatch('networkStateChange', res.networkType);
// 	}
// });
// uni.onNetworkStatusChange(function (res) {
// 	console.log(res+'onNetworkStatusChange')
// 	store.dispatch('networkStateChange', res.networkType);
// });

if (process.env.NODE_ENV === 'production') {
	Vue.config.productionTip = false;
}
// 挂载全局自定义方法
Vue.prototype.$store = store
Vue.prototype.$adpid = ""

Vue.prototype.$http = http;
Vue.prototype.$mConfig = $mConfig;
Vue.prototype.$mAssetsPath = $mAssetsPath;
Vue.prototype.$mUtil = $mUtil;
Vue.component('navbar',navbar);
Vue.component('ldLoading', ldLoading);
Vue.component('nodata',nodata);
Vue.component('loadMore',loadMore);
App.mpType = 'app'

Vue.use(Directives);
// 保留小数点后两位
Vue.filter('keepTwo', value => {
  return  (Math.floor((value || 0) * 100) / 100).toFixed(2);
});

// import Vue from 'vue'
/**
 * 注册指令
 */


const app = new Vue({
	store,
	...App
})
app.$mount()
