From 51875ca4e88a9c61716cf866820ff3f91d9e43be Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sat, 7 Apr 2018 15:51:27 +0200 Subject: [PATCH] [main.js] now asynchronous page data loading --- package.json | 2 +- parcel/main.js | 6 +++--- public_html/index.html | 40 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 5446d3d..b4c4358 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "private": true, "scripts": { "clean": "rm ./public_html/*.{js,css,html,svg,map}", - "dev": "parcel ./parcel/index.html --out-dir ./public_html", + "dev": "parcel watch ./parcel/index.html --out-dir ./public_html", "build": "parcel build ./parcel/index.html --out-dir ./public_html" }, "dependencies": { diff --git a/parcel/main.js b/parcel/main.js index a745a84..3219d05 100644 --- a/parcel/main.js +++ b/parcel/main.js @@ -21,11 +21,11 @@ gs.get.router.beforeEach((to, from, next) => { // {3} Load page script // if( fullpath === 'noauth/login') - require('./page/noauth/login.js'); + import('./page/noauth/login.js').then(next); else if( fullpath === 'noauth/register') - require('./page/noauth/register.js'); + import('./page/noauth/register.js').then(next); else if( fullpath === 'auth/channel') - require('./page/auth/channel.js'); + import('./page/auth/channel.js').then(next); // {4} Let VueRouter do the magic // next(); diff --git a/public_html/index.html b/public_html/index.html index be1d981..6d917f1 100644 --- a/public_html/index.html +++ b/public_html/index.html @@ -1 +1,39 @@ - Douscord
\ No newline at end of file + + + + + Douscord + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + \ No newline at end of file