Tag Archives: Vue accesses static files HTML JSON

Failed to import static file of vue3 static resource. There is no static folder

When using VUe-Cli3 to create a project, you will find that there is no config folder, the only place to configure is the vue.config.js file, and there is no place to configure static resources
If your project needs to import an external JSON HTML file, you’ll need to create a new static folder yourself
Static folder cannot have the same class as SRC if the class is unreachable
You’ll need to create a static folder under public and then write a static file inside so you can access it

When you access it, it’s in a.vue file, or you can use an iframe, of course

axios.get('static/test.html',{accept: 'text/html, text/plain'}).then(function(res){
            console.log(12,res.data)
            // self.html2 = res.data
        })

Vue. config.js will also change the configuration