简体   繁体   中英

Vue nuxt npm run dev new img not found

Hi i add image to assets folder after run npm run dev in my page can't show image在此处输入图片说明

this my code

<div
    :style="{ backgroundImage: `url(${backgroundImagePath})`,
              backgroundPosition: 'center',
              backgroundRepeat: 'no-repeat',
              backgroundSize: 'cover' }"
  >

import backgroundImagePath from '@/assets/img/bg/red2.jpg'

export default {
  components: {
    Navbar, Slider, Login, Footer
  },
  data () {
    return { backgroundImagePath }
  }
}

but, i change to old image import backgroundImagePath from '@/assets/img/bg/red1.jpg' it work在此处输入图片说明

I'm check in folder for sure it has both image

folder tree

--assets
  --bg
    --red1.jpg add before npm run dev
    --red2.jpg add after npm run dev

我尝试重新启动 IIS,所以它可以工作,但我不知道为什么

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM