LeagueStats/client/src/main.js

73 lines
1.5 KiB
JavaScript
Raw Normal View History

2019-03-30 22:55:48 +00:00
import Vue from 'vue'
2019-08-31 17:19:48 +00:00
import VueAxios from './plugins/axios'
import VueMeta from 'vue-meta'
import PortalVue from 'portal-vue'
2023-09-20 20:01:43 +00:00
import './assets/css/main.css'
2019-03-30 22:55:48 +00:00
import App from './App.vue'
import router from './router'
import store from './store'
2019-03-30 22:55:48 +00:00
Vue.config.productionTip = false
2019-08-31 17:19:48 +00:00
Vue.use(VueAxios)
Vue.use(VueMeta)
Vue.use(PortalVue)
2019-11-10 18:01:26 +00:00
Vue.filter('capitalize', (value) => {
return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase()
})
Vue.filter('kilo', (value, shortFormat = true) => {
return value > 1000 || shortFormat ? `${+(value / 1000).toFixed(1)}k` : value
})
Vue.filter('secToTime', (sec, dotNotation = false) => {
if (isNaN(sec)) return 0
const min = Math.floor(sec / 60)
let newSec = Math.floor(sec - min * 60)
newSec = newSec < 10 ? '0' + newSec : newSec
return dotNotation ? `${min}:${newSec}` : `${min}m${newSec}s`
})
Vue.filter('secToHours', (sec) => {
if (isNaN(sec)) return 0
const result = []
const d = Math.floor(sec / (3600 * 24))
2023-09-20 20:01:43 +00:00
const h = Math.floor((sec % (3600 * 24)) / 3600)
const m = Math.floor((sec % 3600) / 60)
if (d > 0) {
result.push(d + ' days')
} else {
if (h > 0) {
result.push(h + 'h')
}
2023-09-20 20:01:43 +00:00
if (m > 0) {
result.push(m + 'm')
}
}
return result.join(' ')
})
Vue.filter('percent', (value) => {
return `${+value.toFixed(1)}%`
})
2019-12-21 16:56:31 +00:00
Vue.filter('round', (value, decimals = 2) => {
if (isNaN(value)) return 0
2019-12-21 16:56:31 +00:00
return parseFloat(value.toFixed(decimals))
2019-11-08 15:04:02 +00:00
})
2019-03-30 22:55:48 +00:00
new Vue({
router,
store,
2023-09-20 20:01:43 +00:00
render: (h) => h(App),
2019-03-30 22:55:48 +00:00
}).$mount('#app')