mirror of
https://github.com/axllent/mailpit.git
synced 2025-06-15 00:05:15 +02:00
Tidy JS code
This commit is contained in:
@ -6,9 +6,11 @@ import Tinycon from 'tinycon';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [commonMixins],
|
mixins: [commonMixins],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
Message
|
Message
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
currentPath: window.location.hash,
|
currentPath: window.location.hash,
|
||||||
@ -30,9 +32,10 @@ export default {
|
|||||||
selected: [],
|
selected: [],
|
||||||
tcStatus: 0,
|
tcStatus: 0,
|
||||||
appInfo: false,
|
appInfo: false,
|
||||||
lastLoaded: false,
|
lastLoaded: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
currentPath(v, old) {
|
currentPath(v, old) {
|
||||||
if (v && v.match(/^[a-z0-9]+-[a-z0-9]+-[a-z0-9]+-[a-z0-9]+-[a-z0-9]+$/)) {
|
if (v && v.match(/^[a-z0-9]+-[a-z0-9]+-[a-z0-9]+-[a-z0-9]+-[a-z0-9]+$/)) {
|
||||||
@ -53,6 +56,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
canPrev: function () {
|
canPrev: function () {
|
||||||
return this.start > 0;
|
return this.start > 0;
|
||||||
@ -61,6 +65,7 @@ export default {
|
|||||||
return this.total > (this.start + this.count);
|
return this.total > (this.start + this.count);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.currentPath = window.location.hash.slice(1);
|
this.currentPath = window.location.hash.slice(1);
|
||||||
window.addEventListener('hashchange', () => {
|
window.addEventListener('hashchange', () => {
|
||||||
@ -80,9 +85,9 @@ export default {
|
|||||||
this.connect();
|
this.connect();
|
||||||
this.loadMessages();
|
this.loadMessages();
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
loadMessages: function () {
|
loadMessages: function () {
|
||||||
|
|
||||||
let now = Date.now()
|
let now = Date.now()
|
||||||
// prevent double loading when UI loads & websocket connects
|
// prevent double loading when UI loads & websocket connects
|
||||||
if (this.lastLoaded && now - this.lastLoaded < 250) {
|
if (this.lastLoaded && now - this.lastLoaded < 250) {
|
||||||
|
@ -5,4 +5,4 @@ import "./assets/styles.scss";
|
|||||||
import "../../node_modules/bootstrap-icons/font/bootstrap-icons.scss";
|
import "../../node_modules/bootstrap-icons/font/bootstrap-icons.scss";
|
||||||
import "bootstrap";
|
import "bootstrap";
|
||||||
|
|
||||||
createApp(App).mount('#app')
|
createApp(App).mount('#app');
|
||||||
|
@ -12,7 +12,7 @@ FakeModal.prototype.show = function () { alert('open fake modal') }
|
|||||||
const commonMixins = {
|
const commonMixins = {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: 0,
|
loading: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -211,4 +211,4 @@ const commonMixins = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export default commonMixins
|
export default commonMixins;
|
||||||
|
@ -35,7 +35,6 @@ export default {
|
|||||||
// force eager callback execution
|
// force eager callback execution
|
||||||
immediate: true
|
immediate: true
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
|
Reference in New Issue
Block a user