How to remove # in vue project
This article mainly introduces how to remove # in the vue project and its ie9 compatibility. The editor thinks it is quite good. Now I will share it with you and give it a reference. Let’s follow the editor to take a look, I hope it can help everyone.
1. How to remove the access address in the vue project
#Add mode in the routing configuration in vue2 (the project created by vue-cli is in src/ router/index.js)
export default new Router({ mode: 'history', routes: [ { path: '/', name: 'menu', component: menu, children: [ { path: 'organization', component: organization, children: [ { path: '', redirect: 'organizationSub' }, { path: 'organizationSub', component: organizationSub } ] }, { path: 'user', component: user }, { path: 'role', component: role } ] } ] })
2. Vue routing principle
2.1 Hash mode: the default routing mode of vue-router.
A single-page application developed by vue has only one html. The change of the url when switching simulates the complete url through the hash mode of the url.
2.2 History mode: configure mode: 'history' in vue2.
Use the history.pushState API to complete the url jump
HTML5 History mode official website introduction: https://router.vuejs.org/zh-cn/essentials/history-mode.html
3. Notes
However, to play this mode well, you also need background configuration support. Because our application is a single-page client application, if the background is not configured correctly, when the user directly accesses http://oursite.com/user/id in the browser, 404 will be returned, which is not good-looking.
So, you need to add a candidate resource on the server side that covers all situations: if the URL does not match any static resources, it should return the same index.html page, which is the page your app depends on. .
vue-router official website has an introduction and background configuration examples: https://router.vuejs.org/zh-cn/essentials/history-mode.html
4. Compatibility
After testing, mode: 'history' does not take effect under IE9. If the Vue project needs to be compatible with IE9, and the background has strict verification of access addresses, it is not recommended to use this mode. . If there are errors or omissions in the content, you are welcome to criticize and correct me~
Related recommendations:
Explanation on building the skeleton of the Vue project with webpack and vue2
About sharing of common components and framework structures of vue projects
Defining global variables and global function methods in vue projects
The above is the detailed content of How to remove # in vue project. 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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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



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_

Share the simple and easy-to-understand PyCharm project packaging method. With the popularity of Python, more and more developers use PyCharm as the main tool for Python development. PyCharm is a powerful integrated development environment that provides many convenient functions to help us improve development efficiency. One of the important functions is project packaging. This article will introduce how to package projects in PyCharm in a simple and easy-to-understand way, and provide specific code examples. Why package projects? Developed in Python

Fermat's last theorem, about to be conquered by AI? And the most meaningful part of the whole thing is that Fermat’s Last Theorem, which AI is about to solve, is precisely to prove that AI is useless. Once upon a time, mathematics belonged to the realm of pure human intelligence; now, this territory is being deciphered and trampled by advanced algorithms. Image Fermat's Last Theorem is a "notorious" puzzle that has puzzled mathematicians for centuries. It was proven in 1993, and now mathematicians have a big plan: to recreate the proof using computers. They hope that any logical errors in this version of the proof can be checked by a computer. Project address: https://github.com/riccardobrasca/flt

Title: Learn more about PyCharm: An efficient way to delete projects. In recent years, Python, as a powerful and flexible programming language, has been favored by more and more developers. In the development of Python projects, it is crucial to choose an efficient integrated development environment. As a powerful integrated development environment, PyCharm provides Python developers with many convenient functions and tools, including deleting project directories quickly and efficiently. The following will focus on how to use delete in PyCharm

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

PyCharm is a powerful Python integrated development environment that provides a wealth of development tools and environment configurations, allowing developers to write and debug code more efficiently. In the process of using PyCharm for Python project development, sometimes we need to package the project into an executable EXE file to run on a computer that does not have a Python environment installed. This article will introduce how to use PyCharm to convert a project into an executable EXE file, and give specific code examples. head
