current position:Home>Record the solution to the error in obtaining the picture in springboot in Vue
Record the solution to the error in obtaining the picture in springboot in Vue
2022-05-15 02:09:30【A delicate cat】
Sometimes we are vue When uploading pictures from the front end , The uploaded image will be saved in springboot Under the path in , So when we're in vue The front end wants to pass el-image label (elementui Components ) When displaying the picture just uploaded , There will be a problem that the picture cannot be loaded , The solution to the problem :
First step : First, test whether it can be in springboot Pass through http://localhost:port number/image.jpg( Take the picture for example ) Access at /resources/static、/resources/public、/resources/resources Static resources under
If you have read the source code , Will find /resources/static、/resources/public、/resources/resources All can be springboot Where static resources are stored in .
If we were /resources/static/img The storage name under the path is “84671d30-53ff-4ebc-b7c5-b41660ef3f72 Cheese berry .jpg” Pictures of the , Then we can go through http://localhost:1252/upload/img/84671d30-53ff-4ebc-b7c5-b41660ef3f72 Cheese berry .jpg Access static resources in the browser .
We may encounter such problems : Through the above url cannot access springboot Static resources in . If there is such a problem , Please refer to this blog :
The second step : stay vue In the front end , stay el-table Of src Use in Tags http://localhost:port number/image.jpg On display in springboot Pictures stored under the path
( It's used here elementui Medium el-table Components , If the el-table as well as slot-scope=“scope” Some questions , Please go to elementui Official website To read )
among scope.row.picture The value of is the value obtained from the database through the back end
therefore ,img The value is http://localhost:1252/upload/img/84671d30-53ff-4ebc-b7c5-b41660ef3f72 Cheese berry .jpg( With cheese and berries .jpg For example ),el-image Components can be displayed and stored in springboot Pictures under the path
copyright notice
author[A delicate cat],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/132/202205120526415664.html
The sidebar is recommended
- Educoder web programming foundation autumn 2021 - HTML5 - text control class label
- Educoder web programming foundation autumn 2021 - HTML5 document header tags and attributes
- Educoder web programming foundation autumn 2021 - HTML5 - text control class label
- Educoder web programming foundation autumn 2021 - overview of web front end development
- Vue data broker
- HTML5 notes - new specifications and new elements
- Lunch break train & problem thinking: on multidimensional array statistics of the number of elements
- Children's Painting Tutorial | children's interesting art lesson "firecrackers say goodbye to the old year and fireworks greet the new year"
- LeetCode 713. Subarray with product less than k
- JavaScript programming training Day6
guess what you like
Vue realizes two-level linkage
Tengine uses brotli to turn on tls1 3 and optimize HTTPS access speed
C + +: remove the specified element from the array
C + +: main elements
Learn about nginx and tomact
IC workplace Theory -- feelings of senior brother of digital ic front-end design after 4 months of employment (Part I)
Vue Chapter 3 scaffolding's most complete render function, props, mixin mixing, plug-ins, browser local storage, component customization events_ Binding, unbinding, global event bus, message subscription and publishing, nexttick, Vue transition and animat
Vue Chapter 5 vuex creates and introduces the use of store, getters and four map methods
***************2、 JS + Vue js***************
A detailed explanation of HTTP protocol + classic interview questions
Random recommended
- Vue Chapter 4 Ajax in Vue: cross domain problems and slot slots
- Online nginx does not support the bug record of error reporting in delete request
- Okhttp sets the public parameters and puts the JSON object into the @ body to request the configuration of the public parameters
- Fluent ignores authentication of HTTPS and WSS certificates
- Browser loading HTML page evokes the most complete strategy of APP in mobile phone
- HTTP status code 304 and Etag details
- Using angularjs for fuzzy dynamic search drop-down box content
- Seamless connection to Macao, Hengqin Island, which is beautiful beyond the sky, is on fire again
- JQuery framework
- Vue mouse down and move event
- A simple Vue answer demo, single choice and multiple choice
- Front end interview question: if the cell in the table is red, click it to turn into white; if it is white, click it to turn into red, and what is not clicked is white
- Vue packaging folding panel plus animation effect
- If the front-end does real-time data acquisition?
- Ant vue3 table sorted by time
- Vue local refresh iframe
- Vue instruction authority
- Vue iframe refresh remains on the original page
- Vue realizes Gaode map API mask, positioning and weather
- Comparison and implementation of bidirectional data binding between react and Vue
- React error report record
- Analysis of react life cycle function
- react demo1 TodoList
- Summary of the differences between state and props in react
- Difference between controlled components and uncontrolled components in react
- Node. JS use get Stream download file
- How does JavaScript copy arrays instead of references
- JavaScript calculates the number of days, hours, minutes and seconds between days
- JQuery get page address parameters
- JavaScript create Download
- node. JS traversal directory
- Tips for using JavaScript string split (how to keep the delimiter)
- Common CSS notes
- JavaScript usage Get the address of the regular function
- New generation node JS web development framework koa zero foundation entry learning notes
- JavaScript notes
- asp. Net core method for modifying HTML without rerun
- Summary of compatibility processing of H5 + Vue cli project in Safari browser
- Summary of amap scheme of Gaode map used in vue3 + TS project
- Summary of filter scheme used in JS code in Vue