mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 07:27:33 +08:00
code refactor
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<v-snackbar v-model="showState">
|
||||
{{ messageContent }}
|
||||
|
||||
<template #actions>
|
||||
<v-btn color="primary" variant="text" @click="showState = false">{{ $t('Close') }}</v-btn>
|
||||
</template>
|
||||
</v-snackbar>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: [
|
||||
'show',
|
||||
'message'
|
||||
],
|
||||
emits: [
|
||||
'update:show'
|
||||
],
|
||||
expose: [
|
||||
'showMessage',
|
||||
'showError'
|
||||
],
|
||||
data() {
|
||||
const self = this;
|
||||
|
||||
return {
|
||||
showState: self.show,
|
||||
messageContent: self.message,
|
||||
resolve: null,
|
||||
reject: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'showState': function (newValue) {
|
||||
this.$emit('update:show', newValue);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showMessage(message) {
|
||||
this.showState = true;
|
||||
this.messageContent = this.$t(message);
|
||||
},
|
||||
showError(error) {
|
||||
this.showState = true;
|
||||
this.messageContent = this.$tError(error.message || error);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user