Es6 can't find local resources in vue-cli?

I used a vue carousel plug-in vue-concise-slider, in the project, but I couldn"t find the picture during initialization

directory structure

.vue



Feb.28,2021

use require to reference a picture, something like this:

  computed: {
    styleObj () {
      return {
        'background': `url(${require(`../assets/${this.type}.png`)}) center center / 70% 70% no-repeat`
      }
    }
  }

your picture resources cannot be parsed. Put the style in a separate style tag


introduce the picture before creating a vue instance, and then use it in data.


there is also a way to throw static (the new version is public), and then the absolute path to lead. All the resources in the logic that the browser has just started to run are quoted in this way.

Menu