import Vue from 'vue';
import App from './App.vue';
import ElementUI from 'element-ui';
import Viewer from 'v-viewer';
import { bootstrap } from '@/cool/core';

import router from '@/router';
import routes from '@/router/routes/views';
import store from '@/store';

import '@/mock';
import '@/icons/index';
import '@/filter/index';
import '@/assets/css/element-variables.scss';
import 'viewerjs/dist/viewer.css';

import '@/assets/iconfont/iconfont.css';

import '@/config/config';
import util from '@/utils/util';
Vue.prototype.$util = util;

Vue.use(Viewer);
Vue.use(ElementUI);

Vue.config.productionTip = false;

const conf = {
	store,
	router,
	['view-routes']: routes,
	['cl-crud']: {
		crud: {
			// dict: {
			// 	sort: {
			// 		prop: 'order',
			// 		order: 'sort'
			// 	}
			// },
			dict: {
				// 搜索
				search: {
					keyWord: 'search' // 模糊查询的关键字
				},
				// 分页参数
				pagination: {
					page: 'page', // 页数
					size: 'pageSize' // 每页显示的条目
				}
			},
			search: {
				key: {
					placeholder: '昵称 / 手机号'
				}
			},
			fn: {
				permission(that) {
					// const { permission } = that.$store.state.menu;
					// const { add, delete: del, update } = that.service.permission || {};

					return {
						// add: permission.includes(add),
						// delete: permission.includes(del),
						// update: permission.includes(update)
						add: true,
						delete: true,
						update: true
					};
				}
			}
		}
	}
};

bootstrap(conf).then(({ router, store }) => {
	store.dispatch('appLoad');

	new Vue({
		router,
		store,
		render: h => h(App)
	}).$mount('#app');
});
