Former-commit-id: 4d5ca1dd46c57e35222860a66c9f98f945fbaad7 [formerly 5a0bea68d0ddec09c95919c1ef45bdff3f602bc6] [formerly b324db325f094e5563f945c41f4f9eeb0b2df086 [formerly 698a08e1a98f49aab1d5b358ec0781975413cc72]] Former-commit-id: 6c39601f33482edafad63f4b39e10e2720db2813 [formerly 02a9c37289ce3d27eee55f3eb3052391349adc0e] Former-commit-id: fd29981acff35fa5428af5e1d95fe1d53bba0459
29 lines
727 B
Vue
29 lines
727 B
Vue
<template>
|
|
<button @click="change" aria-label="Switch View" title="Switch View" class="action">
|
|
<i class="material-icons">{{ icon() }}</i>
|
|
<span>Switch view</span>
|
|
</button>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'switch-button',
|
|
methods: {
|
|
change: function (event) {
|
|
let display = 'mosaic'
|
|
|
|
if (this.$store.state.req.data.display === 'mosaic') {
|
|
display = 'list'
|
|
}
|
|
|
|
this.$store.commit('listingDisplay', display)
|
|
document.cookie = `display=${display}; max-age=31536000; path=${this.$store.state.baseURL}`
|
|
},
|
|
icon: function () {
|
|
if (this.$store.state.req.data.display === 'mosaic') return 'view_list'
|
|
return 'view_module'
|
|
}
|
|
}
|
|
}
|
|
</script>
|