Pictures in the vue plug-in, but when used in the gallery project

problem description

pictures in the vue plug-in, but 404 when used in a project

the environmental background of the problems and what methods you have tried

Project address: https://github.com/BengBu-Yue.

related codes


// npm
// node_modules

git clone https://github.com/BengBu-YueZhang/vue-message-box.git
// main.js

import MsgBox from "vue-message-box"
import "vue-message-box/dist/MsgBox.css"

Vue.use(MsgBox)
// xx.vue

this.$toast({
  duration: 10000
})

what result do you expect? What is the error message actually seen?

Pictures used in plug-ins, 404


try require ;

for example:

will

return {
   imgUrl:"../assets/images/fk.jpg"
}

rewrite to

return {
   imgUrl: require("../assets/images/fk.jpg")
}
Menu