How to use Vue to remove the # sign from the path
This time I will show you how to operate Vue to remove the # number in the path, and what are the precautions when operating Vue to remove the # number in the path. The following is a practical case, let's take a look.
As we all know, vue-router has two modes, hash mode and history mode.
With # is the hash mode.
Just set the mode in the router to history
Then there is a problem. As soon as the interface is refreshed, it changes to 404! ! ! !
After searching online, I need to configure the back-end environment.
Only the nginx configuration is listed here. For other configurations, click here to go to the official website.
Configure config/index.js first
Modify assetsPublicPath to the root directory
module.exports = { build: { env: require('./prod.env'), index: path.resolve(dirname, '../dist/index.html'), assetsRoot: path.resolve(dirname, '../dist'), assetsSubDirectory: 'static', assetsPublicPath: '/', // hash 模式会默认的在此处 添加为 assetsPublicPath: './' productionSourceMap: true, ... } }
Then configure nignx
server { listen 0.0.0.0:12345; location / { root /home/我的应用跟目录; try_files $uri $uri/ /index.html =404; // 这个是重点 } error_page 404 /index.html }
Url no longer has #, how perfect
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
How to use vue source code to parse the event mechanism
How to operate JS to obtain the city and geographical location of the user
The above is the detailed content of How to use Vue to remove the # sign from the path. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Windows 11 has so many customization options, including a range of themes and wallpapers. While these themes are aesthetic in their own way, some users still wonder where they stand in the background on Windows 11. This guide will show you the different ways to access the location of your Windows 11 theme. What is the Windows 11 default theme? The default theme background of Windows 11 is an abstract royal blue flower blooming with a sky blue background. This background is one of the most popular, thanks to the anticipation before the release of the operating system. However, the operating system also comes with a range of other backgrounds. Therefore, you can change the Windows 11 desktop theme background at any time. Themes are stored in Windo

After many users use the latest win11 system, a small arrow appears on the shortcut icon on the desktop, which affects the appearance. Therefore, we have brought you a tutorial to remove the small arrow from the win11 shortcut icon. If you also think it does not look good, come and watch it. Let’s see how it works. How to remove the small shortcut arrow in win11: 1. First, press the "win+r" shortcut keys on the keyboard at the same time. 2. Then open "Run", enter the "regedit" command, and click the "OK" button. 3. Next, enter the "Registry Editor" page and click to open: HKEY_CLASSES_ROOT\lnkfile (can be copied and pasted). 4. After re-entering, right-click "lsShortcut" and select

Removing watermarks is a useful tool in the software Scanner. Some users are not sure how to remove watermarks in Scanner. You can click Remove Watermark in Edit PDF on the save interface to close it. Next, the editor will explain Users brought us an introduction to how to remove watermarks. If you are interested, come and take a look! Scanner King usage tutorial How to remove the watermark with Scanner King? Answer: You can click on the save interface to edit the watermark removal in the PDF. Details: 1. Enter the software and click the [Camera] icon. 2. Photograph and scan the documents that need to be watermarked. 3. Click [→] to proceed to the next step. 4. After completing editing, click [✓]. 5. Click [Edit PDF]. 6. Select [Remove Watermark] below.

How to remove shortcut arrow in win11? Many Win11 users have created shortcut icons on the system desktop, but there is a small arrow-like symbol on the shortcut icon, which makes the overall icon look very ugly. So is there any corresponding method to remove the small arrow on the Windows 11 system shortcut icon? Many friends don’t know how to operate in detail. The editor below has compiled a tutorial on clearing the small arrow shortcuts on the desktop in Win11. If you are interested, follow the editor and read on! Tutorial on clearing the small arrow shortcuts on the desktop in win11 1. Open the menu bar and find Run or just win+R. 2. Enter regedit and click OK. 3. Locate HKEY_CLASSES_

This video cannot be played due to a technical error. (Error Code: 102006) This guide provides simple fixes for this common problem and continue your coding journey. We will also discuss the causes of Java errors and how to prevent it in the future. What is "Error: Main class not found or loaded" in Java? Java is a powerful programming language that enables developers to create a wide range of applications. However, its versatility and efficiency come with a host of common mistakes that can occur during development. One of the interrupts is Error: Main class user_jvm_args.txt not found or loaded, which occurs when the Java Virtual Machine (JVM) cannot find the main class to execute a program. This error acts as a roadblock even in

Use the imitation stamp to pick up the color of the picture and then apply it. Tutorial Applicable Model: Lenovo AIO520C System: Windows 10 Professional Edition: Photoshop 2020 Analysis 1 First enter PhotoShop and open the mosaic picture. 2In the toolbar on the left, find and click Clone Stamp. 3 Then press and hold the Alt key on the keyboard. 4. Move the mouse to pick the color in the picture. 5Then release the Alt key on the keyboard. 6Finally, use the mouse to smear on the mosaic area to eliminate the mosaic. Supplement: What is the principle of mosaic removal? 1. If you want to remove mosaic from a picture, it is equivalent to painting on a canvas with an outline. Although the color aspect is easier to handle, it is still very difficult to complete. because

A file path is a string used by the operating system to identify and locate a file or folder. In file paths, there are two common symbols separating paths, namely forward slash (/) and backslash (). These two symbols have different uses and meanings in different operating systems. The forward slash (/) is a commonly used path separator in Unix and Linux systems. On these systems, file paths start from the root directory (/) and are separated by forward slashes between each directory. For example, the path /home/user/Docume

How to remove the word "Qingyan" from Qingyan Camera? When taking photos with Qingyan Camera APP, the word "Qingyan" will be left behind. Many friends don't know how to remove the word "Qingyan". Next, the editor brings the word "Qingyan" to the players. Tutorial on how to remove the word "light face" on the face camera. Interested players should come and take a look! Qingyan Camera usage tutorial: How to remove Qingyan characters from Qingyan Camera 1. First unlock the phone and enter the desktop, find the [Qingyan Camera] APP and open the entry page; 2. Then jump to the main page of the Qingyan Camera APP and click on the upper left corner [Circle] button; 3. Then the multi-function menu bar will expand at the top, select [Camera Settings]; 4. Finally, find the button behind [Watermark Settings] as shown in the picture below and slide it to dark color to remove it.
