Home > Web Front-end > JS Tutorial > body text

Solve vue-cli packaged image path error

php中世界最好的语言
Release: 2018-04-16 15:02:23
Original
1313 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!