Vue dynamically loads pictures, but keeps reporting errors

load picture banner-biometric2 in vue, but keep reporting this error:

This dependency was not found:

* /static/banner-biometric2 in ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/pages/Home.vue

To install it, you can run: npm install --save /static/banner-biometric2

two methods are used to solve the problem, both of which report the same error:

  1. import bannerBiometric from"@ / assets/images/banner-biometric2"
  2. import bannerBiometric from"/ static/banner-biometric2"

at first, the path of the image is in the assets directory. According to the information found on the Internet, it is said that the static resources should be placed in the static directory, but it is still introduced using import, but the same error is still reported. I don"t know what caused it.

Aug.31,2021

what's your picture suffix

Menu