Emit an event after mounted

This commit is contained in:
Pig Fang 2018-09-08 14:40:53 +08:00
parent cd43fb6f0e
commit 4db7872c02
2 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,6 @@
import Vue from 'vue';
import './js';
import * as emitter from './js/event';
import routes from './components/route';
Vue.config.productionTip = false;
@ -20,6 +21,9 @@ if (process.env.NODE_ENV === 'development') {
Vue.prototype.$route = (new RegExp(`^${route.path}$`, 'i')).exec(blessing.route);
new Vue({
el: route.el,
mounted() {
emitter.emit('mounted', { el: route.el });
},
render: h => h(route.component)
});
}

View File

@ -10,7 +10,6 @@ window.Request = function Request(url, init) {
this.headers = new Map(Object.entries(init.headers));
};
test('the GET method', async () => {
const json = jest.fn().mockResolvedValue({});
window.fetch = jest.fn().mockResolvedValue({