[Client] Improve alert component
This commit is contained in:
@ -7,7 +7,6 @@ import Vuex from 'vuex';
|
||||
import VueRouter from 'vue-router';
|
||||
import VAnimateCss from 'v-animate-css';
|
||||
import VModal from 'vue-js-modal';
|
||||
import VueSweetalert2 from 'vue-sweetalert2';
|
||||
import VueI18n from 'vue-i18n';
|
||||
|
||||
import VueHotkey from './common/hotkey';
|
||||
@ -16,6 +15,7 @@ import checkForUpdate from './common/scripts/check-for-update';
|
||||
import MiOS from './mios';
|
||||
import { clientVersion as version, codename, lang } from './config';
|
||||
import { builtinThemes, lightTheme, applyTheme } from './theme';
|
||||
import Alert from './common/views/components/alert.vue';
|
||||
|
||||
if (localStorage.getItem('theme') == null) {
|
||||
applyTheme(lightTheme);
|
||||
@ -258,7 +258,6 @@ Vue.use(VueRouter);
|
||||
Vue.use(VAnimateCss);
|
||||
Vue.use(VModal);
|
||||
Vue.use(VueHotkey);
|
||||
Vue.use(VueSweetalert2);
|
||||
Vue.use(VueI18n);
|
||||
|
||||
Vue.component('fa', FontAwesomeIcon);
|
||||
@ -430,6 +429,13 @@ export default (callback: (launch: (router: VueRouter) => [Vue, MiOS]) => void,
|
||||
document.body.appendChild(x.$el);
|
||||
return x;
|
||||
},
|
||||
alert(opts) {
|
||||
return new Promise((res) => {
|
||||
const vm = this.new(Alert, opts);
|
||||
vm.$once('ok', () => res(true));
|
||||
vm.$once('cancel', () => res(false));
|
||||
});
|
||||
}
|
||||
},
|
||||
router,
|
||||
render: createEl => createEl(App)
|
||||
|
Reference in New Issue
Block a user