use: src= "item.url"
Why can"t you bind a picture in this way? it can only be written as static
or write
in datadata () {
return {
item: {
url: require("~/assets/img/home.png")
}
}
}
use: src= "item.url"
Why can"t you bind a picture in this way? it can only be written as static
or write
in datadata () {
return {
item: {
url: require("~/assets/img/home.png")
}
}
}
because you write it statically, it will be compiled by webpack to get the correct real path of the packaged image.
if you write dynamic, webpack will not compile, and put '~ / assets/img/home.png'
in the src of your picture intact. Do you have this picture in https://img.codeshelper.com/upload/img/2021/04/11/gveaturhrqb16048.png
?
put the picture in the static directory and change it to this
require('static/img/home.png')
the path where your url is'~ / assets/img/home.png', is not accessible under your server.
you can put this picture on cdn, or under a path that your server can access directly.
Hello. Did you ask this question?
Previous: How to solve the stack overflow caused by the creation of segment tree by js?
Next: The shape of a circle! The computer version looks normal, but the mobile version is not normal!
I want to load the data on the first screen on the server, that is, there is still part of the return data, hidden in asyncData, and I want to render it on the client. How do I write this? ...
for the first time it s all wrong anyway. I followed nuxt.js s official tutorial-- ...
how do Vue projects built with Nuxt.js share header and footer files? only files with section contents are placed in the page directory. Navigation bars and footers and every time you jump to a new route, navigation doesn t have to be reloaded. Gods, ...
each time nuxt uses keep-alive, to switch pages, it will empty the data in data, which is inconsistent with the performance of keep-alive in normal vue-cli-built projects. for example, the asynchronously acquired data I loaded in list is switched to i...
current Nuxt projects need to be published to different environments corresponding to but the value obtained through process.env.NODE_ENV is not the value assigned here but production what is the reason for this? How can I get the desired result...
nuxt 1.4 uses keepAlive, in nuxt, but I find that when the page component is switched, the data in data will be reset and emptied when entering the interface . Is this his bug? if there is a problem with the setting, how can I modify the setting? ...
the packaged scripts are generated dynamically by nuxt. How to mark a global variable so that your business code can tell which command it is? (for example, the interface domain names of different commands are different) ...
after I install it using the documentation s npm installation method, I introduce a date selector as in the case, but the time is in English elementUI how to change this ...
ask nuxt.js s vue single file, how to make some vue scripts to be rendered by browser instead of server. if the pull-up load belongs to browser rendering through ajax, how to express the .vue single file in ssr mode. Please, everyone. I m in a hurry...
D: code nuxtjsdemo node_modules nuxt lib core middleware nuxt.js:72 const policies = this.options.render.csp.policies ? {...this.options.rende r.csp.policies} : null SyntaxError: Unexpected token ... platform environment nodejs 8.2.0 v...
add components with npm install v-distpicker add vendor: to nuxt.config.js [ axios , v vendor: distressed ] how to write in the vue interface, ask the great gods to save ...
report this error with pm2 logs main startup, but netstat-anp | grep port 80 is not occupied ...
my global variable configuration vue :@base-color-red less@ ...
I use nuxt to do a project that separates the front and rear ends, and uses docker to build the project independently. When the server needs generate to generate static files to access, and asyncData obtains the initial data, the data obtained by my loca...
I use the npm run dev command, but I use npm run generate to package and generate the dist folder, and open index.html to find that js is all invalid. When I first met vue, I asked for guidance. ...
because vue version 2.5 or above is required to use element-ui, this error is reported after updating the vue, refresh page separately. I really don t understand. links on the diagram ...
if you want to define a global less variable and then use it, how do you configure it ...
I have a configuration file in js format, and I don t want to read the configuration every time I have a request. (what if I configure it in cdn,? (not so good on the server Synchronize in the past) if I am writing a service like golang php c, I will c...
page: structure: index.vue homeindex.vue :homeindex.vuevue-awesome-swiper: ...
the project directory automatically generated by nuxt.js no longer has webpack.config.js, so how to configure things such as scss, less, autoprefixer, and url? ...