Home  >  Article  >  Web Front-end  >  Solve vue-cli packaged image path error

Solve vue-cli packaged image path error

php中世界最好的语言
php中世界最好的语言Original
2018-04-16 15:02:231319browse

This time I will bring you solutions to vue-cli packaging picturepath errors and solutions to vue-cli packaged picture path errorsWhat are the precautions? Here are practical cases. Let’s take a look.

I recently used vue-cli to build a project for the first time. When I packaged and deployed it to the server for the first time, picture could not be loaded. I finally figured it out by combining online methods. There are two types of deploying projects to the server: one is to deploy directly to the root directory of the server, and the other is to deploy to a subdirectory of the server

1. Let’s first deploy it to the root directory, for example: www.****.com

Find the index.js file

under the config folder in the project Change assetsPublicPath: '/' in the file to the following box.

The purpose is to change the absolute path to a relative path

If you put it in the root directory, it will be fine

2. Place it in a subdirectory, such as: www.***.com/community/dist

Divided into two steps, the first step is the same as above

After packaging with the npm run build command, place the dist file in the community folder so that the image can be displayed.

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:

node operates text to generate images

##Detailed explanation of the interaction and verification steps when AngularJs users log in

The above is the detailed content of Solve vue-cli packaged image path error. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn