How does vue-cli get the pictures under static?

items are listed below:
screenshot 2018-04-04 4.37.25 p.m.
clipboard.png

set

in config/index.js
build:{
    assetsSubDirectory: "static",
    assetsPublicPath: "/",
}

then get logo.png

in the vue file
data(){
    return {
        logoSrc: require("/static/logo.png")
    }
}

npm run dev
result error:

This dependency was not found:

* /static/logo.png in ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/components/login/login.vue

To install it, you can run: npm install --save /static/logo.png

solve.

Mar.01,2021

require uses a relative path, and then generally refers to the one under the assets folder.
in fact, the files in static can be written directly to the absolute path.

logoSrc: '/static/xxx'
// 
logoSrc: require('../../static/xxx')
< hr >

then use the absolute path to write directly. If you run it after packaging, you need to start it with the service, otherwise the absolute path will be wrong and other configurations need to be changed.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b9fe10-2f4ab.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b9fe10-2f4ab.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?