HomeAccounting
98 строк · 2.5 Кб
1
2/**
3* First we will load all of this project's JavaScript dependencies which
4* includes Vue and other libraries. It is a great starting point when
5* building robust, powerful web applications using Vue and Laravel.
6*/
7
8require('./bootstrap');9
10window.Vue = require('vue');11
12/**
13* Next, we will create a fresh Vue application instance and attach it to
14* the page. Then, you may begin adding components to this application
15* or customize the JavaScript scaffolding to fit your unique needs.
16*/
17
18import Vuex from 'vuex'19import Vuetify from 'vuetify';20import VSwipe from 'vswipe';21
22
23Vue.use(Vuex);24Vue.use(Vuetify);25Vue.use(VSwipe);26
27import privateArea from './components/PrivateArea/PrivateArea.vue';28
29/**
30* Mobile detected
31* @type {MobileDetect}
32*/
33let MobileDetect = require('mobile-detect');34let md = new MobileDetect(window.navigator.userAgent);35
36const mobile = md.mobile();37
38const store = new Vuex.Store({39state: {40preloader: false,41
42mobile: mobile,43
44alertControl: {45show: false,46type: 'success',47message: '',48},49defaultCurrency: 643,50},51mutations: {52setPreloader(state, status=true) {53
54if(status === false) {55setTimeout(() => {56state.preloader = status;57}, 1000)58}59else {60state.preloader = status;61}62
63},64setAlert(state, object) {65state.alertControl.type = object.type;66state.alertControl.show = object.status;67state.alertControl.message = object.message;68},69AlertError(state, error) {70state.alertControl.type = 'error';71state.alertControl.show = true;72state.alertControl.message = 'Ошибка передачи транзакции, попробуйте перезапустить страницу. Ответ сервера: '+error;73},74setDefaultCurrency(state, currencyCode) {75state.defaultCurrency = currencyCode;76}77},78getters: {79getPreloader: state=> {80return state.preloader;81},82getAlert: state => {83return state.alertControl;84},85mobile: state => {86return state.mobile;87},88getDefaultCurrency: state => {89return state.defaultCurrency;90}91},92});93
94const app = new Vue({95el: '#privateArea',96template: '<private-area></private-area>',97components: {privateArea},98store
99});100