Добавил компонент MessageBox

This commit is contained in:
Book Pauk
2019-01-13 02:51:19 +07:00
parent e79fcfa868
commit 711c8d1aff
2 changed files with 12 additions and 10 deletions

View File

@@ -13,7 +13,6 @@
<el-button size="mini" @click="loadFle"> <el-button size="mini" @click="loadFle">
Загрузить файл с диска Загрузить файл с диска
</el-button> </el-button>
<span class="bottom-span"><pre>{{ loadState }}</pre></span>
</div> </div>
<div class="part bottom"> <div class="part bottom">
<span v-if="config.mode == 'omnireader'" class="bottom-span clickable" @click="openComments">Комментарии</span> <span v-if="config.mode == 'omnireader'" class="bottom-span clickable" @click="openComments">Комментарии</span>
@@ -34,7 +33,6 @@ export default @Component({
}) })
class LoaderPage extends Vue { class LoaderPage extends Vue {
bookUrl = null; bookUrl = null;
loadState = null;
created() { created() {
this.commit = this.$store.commit; this.commit = this.$store.commit;
@@ -59,7 +57,7 @@ class LoaderPage extends Vue {
async submitUrl() { async submitUrl() {
if (this.bookUrl) { if (this.bookUrl) {
const loading = this.$loading({ target: this.$refs.main, customClass: 'loading'}); const loading = this.$loading({target: this.$refs.main, customClass: 'loading'});
try { try {
const book = await readerApi.loadBook(this.bookUrl, (state) => { const book = await readerApi.loadBook(this.bookUrl, (state) => {
const progress = state.progress || 0; const progress = state.progress || 0;
@@ -67,8 +65,8 @@ class LoaderPage extends Vue {
}); });
loading.close(); loading.close();
} catch (e) { } catch (e) {
this.loadState = e.message;
loading.close(); loading.close();
this.$alert(e.message, 'Ошибка', {type: 'error'});
} }
} }
} }

View File

@@ -56,6 +56,9 @@ import './theme/notification.css';
import Loading from 'element-ui/lib/loading'; import Loading from 'element-ui/lib/loading';
import './theme/loading.css'; import './theme/loading.css';
import MessageBox from 'element-ui/lib/message-box';
import './theme/message-box.css';
const components = { const components = {
ElMenu, ElMenuItem, ElButton, ElCheckbox, ElTabs, ElTabPane, ElTooltip, ElMenu, ElMenuItem, ElButton, ElCheckbox, ElTabs, ElTabPane, ElTooltip,
ElContainer, ElAside, ElMain, ElHeader, ElContainer, ElAside, ElMain, ElHeader,
@@ -69,12 +72,13 @@ for (let [name, comp] of Object.entries(components)) {
//Vue.use(Loading.directive); //Vue.use(Loading.directive);
Vue.prototype.$loading = Loading.service; Vue.prototype.$loading = Loading.service;
//Vue.prototype.$msgbox = MessageBox; Vue.prototype.$msgbox = MessageBox;
//Vue.prototype.$alert = MessageBox.alert; Vue.prototype.$alert = MessageBox.alert;
//Vue.prototype.$confirm = MessageBox.confirm; Vue.prototype.$confirm = MessageBox.confirm;
//Vue.prototype.$prompt = MessageBox.prompt; Vue.prototype.$prompt = MessageBox.prompt;
Vue.prototype.$notify = Notification; Vue.prototype.$notify = Notification;
//Vue.prototype.$message = Message; //Vue.prototype.$message = Message;
import locale from 'element-ui/lib/locale/lang/ru-RU'; import lang from 'element-ui/lib/locale/lang/ru-RU';
Vue.prototype.$ELEMENT = { locale }; import locale from 'element-ui/lib/locale';
locale.use(lang);