The vue project introduces particles.js to realize the particle effect, but there is a problem when switching pages?

In the

vue-cli project, I directly introduced the particls library into index.html, and the related files are placed in the static directory

.
<div id="particles-js"></div>
//
<script type="text/javascript" src="static/js/particles.min.js"></script>
<script type="text/javascript" src="static/js/app.js"></script>

this is fine. Now there is a requirement, when the user url input error, to jump to the 404 page, the guard navigation I wrote in the component.

beforeRouteEnter:function(to, from, next){
    // fetchData;
    next(vm => {
        vm.fetchData(function(result){
            console.log(result);
            if(result)
                next();
            else
                next({name:"Home"}); // home
        });    
    })
},
The

page can jump, but the particles are not displayed. The following error is reported

Uncaught SyntaxError: Unexpected token <

Open the relevant file and find that the content has been replaced with the content of index.html (sorry I can"t post the picture for the time being)

Why?


probably know why, history mode? Use the absolute path src= "/ static" to try

for the two outreach files.
Menu