ffplayout/plugins/filters.js

21 lines
489 B
JavaScript
Raw Normal View History

2020-04-13 15:34:47 -04:00
import Vue from 'vue'
Vue.filter('toMin', function (sec) {
2020-04-16 12:31:04 -04:00
if (sec) {
const minutes = Math.floor(sec / 60)
const seconds = Math.round(sec - minutes * 60)
return `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')} min`
} else {
return ''
}
2020-04-13 15:34:47 -04:00
})
2020-04-30 11:11:15 -04:00
Vue.filter('filename', function (path) {
if (path) {
const pathArr = path.split('/')
return pathArr[pathArr.length - 1]
} else {
return ''
}
})