Skip to content

Instantly share code, notes, and snippets.

@ishaquehassan
Created December 13, 2021 12:32
Show Gist options
  • Save ishaquehassan/41e341d3764814f47e77e125988571c4 to your computer and use it in GitHub Desktop.
Save ishaquehassan/41e341d3764814f47e77e125988571c4 to your computer and use it in GitHub Desktop.
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
window.Vue = require('vue').default;
const Vue = window.Vue;
require('vue-select/dist/vue-select.css')
Vue.component('v-select', require('vue-select').VueSelect)
/**
* The following block of code may be used to automatically register your
* Vue components. It will recursively scan this directory for the Vue
* components and automatically register them with their "basename".
*
* Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
*/
const files = require.context('./../views/', true, /\.vue$/i);
files.keys().forEach(fileKey => {
if(fileKey.indexOf('components/') >= 0){
return;
}
Vue.component(fileKey.split('/').pop().split('.')[0], files(fileKey).default);
})
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
const vueFire = require('vuefire');
Vue.use(vueFire.firestorePlugin);
const VueRouter = require('vue-router').default;
Vue.use(VueRouter);
const routes = require('./router').default;
const router = new VueRouter({
routes,
mode: 'hash',
})
require('./mixins');
window.getRandomArbitrary = function (min, max) {
return Math.round(Math.random() * (max - min) + min);
}
const app = new Vue({
router,
el: '#vue',
methods:{
asset(path){
return window.location.origin+"/"+path;
}
// price(amount){
// const format = process.env.MIX_APP_PRICE_FORMAT;
// return format.replaceAll('#AMOUNT',new Intl.NumberFormat().format(parseFloat(amount)));
// }
},
computed:{
categories:() => window.SYSTEM_DEFAULT_CATEGORIES
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment