We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3507a93 + 44b4b5b commit 7d03df6Copy full SHA for 7d03df6
package-lock.json
package.json
@@ -16,6 +16,7 @@
16
"vue": "^2.6.10",
17
"vue-codemirror": "^4.0.6",
18
"vue-fragment": "^1.5.1",
19
+ "vue-loading-overlay": "^3.2.0",
20
"vue-router": "^3.0.3",
21
"vuetify": "^2.0.0",
22
"vuex": "^3.0.1",
src/App.vue
@@ -1,21 +1,39 @@
1
<template>
2
-<Layout>
3
- <v-container>
4
- <router-view></router-view>
5
- </v-container>
6
-</Layout>
+ <fragment>
+ <loading
+ :active.sync="isLoading"
+ color="indigo"
+ loader="dots"
7
+ is-full-page
8
+ ></loading>
9
+ <Layout>
10
+ <v-container>
11
+ <router-view></router-view>
12
+ </v-container>
13
+ </Layout>
14
+ </fragment>
15
</template>
<script>
+import Loading from 'vue-loading-overlay';
+import 'vue-loading-overlay/dist/vue-loading.css';
+import { mapGetters } from 'vuex';
+
import Layout from './components/layout';
23
24
export default {
25
name: 'App',
26
components: {
27
Layout,
28
+ Loading,
29
},
30
data: () => ({
31
//
32
}),
33
+ computed: {
34
+ ...mapGetters([
35
+ 'isLoading',
36
+ ]),
37
+ },
38
};
39
</script>
src/main.js
@@ -1,12 +1,12 @@
+import 'roboto-fontface/css/roboto/roboto-fontface.css';
+import '@mdi/font/css/materialdesignicons.css';
import { sync } from 'vuex-router-sync';
import { Plugin } from 'vue-fragment';
import Vue from 'vue';
import App from './App';
import router from './router';
import store from './store';
import vuetify from './plugins/vuetify';
-import 'roboto-fontface/css/roboto/roboto-fontface.css';
-import '@mdi/font/css/materialdesignicons.css';
Vue.config.productionTip = false;
sync(store, router);
src/store/index.js
@@ -4,6 +4,7 @@ import Vue from 'vue';
import Vuex from 'vuex';
import authentication from './modules/authentication';
+import { Loading } from './plugins';
Vue.use(Vuex);
@@ -12,24 +13,31 @@ const debug = process.env.NODE_ENV !== 'production';
const plugins = debug ? [
createLogger(),
// createPersistedState(),
] : [
createPersistedState(),
];
export default new Vuex.Store({
state: {
baseUrl: '/api',
+ loading: false,
mutations: {
-
+ setLoading(state, loading) {
+ state.loading = loading;
actions: {
modules: {
authentication,
getters: {
+ isLoading(state) {
+ return state.loading;
40
41
getErrorMessage: () => (response) => {
42
console.log('HERE', response);
43
const { status, data: { data: { errors } = {}, message } } = response;
src/store/plugins/index.js
@@ -0,0 +1 @@
+export { default as Loading } from './loading';
src/store/plugins/loading.js
@@ -0,0 +1,12 @@
+export default (store) => {
+ store.subscribeAction({
+ before: (action) => {
+ console.log(`before action ${action.type}`);
+ store.commit('setLoading', true, { root: true });
+ after: (action) => {
+ console.log(`after action ${action.type}`);
+ store.commit('setLoading', false, { root: true });
+ });
+};
vue.config.js
@@ -2,9 +2,7 @@ module.exports = {
devServer: {
proxy: {
'/api': {
- target: 'https://localhost:8000',
- ws: true,
- changeOrigin: true,
+ target: 'http://localhost:8000',
headers: {
Connection: 'keep-alive',
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments