mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
chore: move vue components to separate js files
This commit is contained in:
24
static/assets/js/components/summary.js
Normal file
24
static/assets/js/components/summary.js
Normal file
@ -0,0 +1,24 @@
|
||||
PetiteVue.createApp({
|
||||
$delimiters: ['${', '}'],
|
||||
state: {
|
||||
showDropdownTimepicker: false,
|
||||
},
|
||||
fromDate: fromDate,
|
||||
toDate: toDate,
|
||||
timeSelection: timeSelection,
|
||||
onDateUpdated() {
|
||||
formTimePicker.submit()
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener('click', (e) => {
|
||||
const skip = findParentAttribute(e.target, 'data-trigger-for')?.value
|
||||
Object.keys(this.state).filter(k => k !== skip).forEach(k => this.state[k] = false)
|
||||
})
|
||||
|
||||
const query = new URLSearchParams(window.location.search)
|
||||
if (query.has('interval')) {
|
||||
const refEl = document.getElementById(`time-option-${query.get('interval')}`)
|
||||
this.timeSelection = refEl ? refEl.innerText : 'Unknown'
|
||||
}
|
||||
}
|
||||
}).mount('#summary-page')
|
Reference in New Issue
Block a user