Vue multi-page configuration details

Vue multi-page configuration details

1. The difference between multiple pages

The concept of single-page application emerged with the emergence of frameworks such as AngularJS , React , and Ember in the past few years. In the previous introduction, we talked about partial refresh of the page in page rendering, and the single-page application uses the partial refresh capability of the page to refresh the page content when switching pages, thereby obtaining a better experience.

2. SPA and MPA

The differences between SinglePage SinglePage Web Application Application (SPA) and MultiPage Application (MPA) are as follows:

title SPA MPA
composition One main page + multiple page fragments Multiple full pages
Resource sharing (css, js) Shared resources only need to be loaded once Each page needs to load common resources
url pattern xxx/#/page1 xxx/#/page2 xxx/page1.html xxx/page2.html
Refresh method Partial page refresh or change Full page refresh
Page jump The shell remains unchanged, the local page content is updated, and the jump animation is easy to implement Jumping from one page to another page, the jump animation cannot be realized
User Experience Fast switching between page fragments, good user experience Page switching requires reloading, which is slow and has low fluency, resulting in poor user experience
Data Transfer On the same page, global variables are easy to implement Relying on URL parameters, cookies, localStorage, etc., is difficult to implement
Search Engine Optimization (SEO) It is difficult to implement and is not conducive to SEO retrieval. Simple implementation method
Applicable scenarios Applications with high experience requirements Need a search engine friendly app

3. Vue Cli scaffolding configuration

first step:

We create a main page and a sub-page under the public file. The directory structure is as follows

Step 2:

With the main page and the sub-page, there must be corresponding main page entry files and sub-page entry files. The directory structure is as follows

Step 3:

Configuring pages in vue.config.js can be understood as a configuration mapping of multiple pages.

pages: {
    index: {
        entry: 'src/main.js',
        template: 'public/index.html',
        filename: 'index.html',
    },
    bangban:
        entry: 'src/banban.js',
        template: 'bangban.html',
        filename: 'public/bangban.html'
    }
}


This is the end of this article about the details of vue multi-page configuration. For more relevant vue multi-page configuration content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed explanation of Vue-cli3 multi-page configuration
  • VUE.CLI4.0 configuration of multiple page entries
  • Detailed steps to add multi-page configuration to the Vue project
  • Vue configuration multi-page application sample code
  • How to implement Vue configuration with multiple pages
  • WebPack configuration vue multi-page skills
  • Project created by vue-cli, implementation method of configuring multiple pages

<<:  Example of creating a virtual host based on Apache port

>>:  Implementation code for saving images to MySQL database and displaying them on the front-end page

Recommend

Solutions to black screen when installing Ubuntu (3 types)

My computer graphics card is Nvidia graphics card...

Several solutions for CSS record text icon alignment

It is very common to see images and text displaye...

In-depth understanding of Linux load balancing LVS

Table of contents 1. LVS load balancing 2. Basic ...

Some experience sharing on enabling HTTPS

As the domestic network environment continues to ...

VMware vsphere 6.5 installation tutorial (picture and text)

vmware vsphere 6.5 is the classic version of vsph...

Example code for implementing an Upload component using Vue3

Table of contents General upload component develo...

Common HTML tag writing errors

We better start paying attention, because HTML Po...

JS realizes simple picture carousel effect

This article shares the specific code of JS to ac...

Centos7.5 installs mysql5.7.24 binary package deployment

1. Environmental preparation: Operating system: C...

HTML table layout example explanation

The elements in an HTML document are arranged one...

Detailed explanation of MySQL backup and recovery practice of mysqlbackup

1. Introduction to mysqlbackup mysqlbackup is the...

4 ways to avoid duplicate insertion of data in Mysql

The most common way is to set a primary key or un...

Detailed tutorial on configuring local yum source in CentOS8

The centos8 distribution is released through the ...

js to achieve waterfall flow layout (infinite loading)

This article example shares the specific code of ...

Nginx reverse proxy forwards port 80 requests to 8080

Let's first understand a wave of concepts, wh...