Vue SRC dynamically loads how to get pictures


vue src动态加载请求获取图片的方法 2. Configure a picture path in DATA

DATA () {Return {Formdata: {Avatar: Require (‘@ / assets / icon1524737568182.png’), Motto: ‘xxxxxxxxxx’}, routers: this. $ router.Options.routes}}
3. Introduce pictures in the required place
   

II. Loading request acquired pictures
  
1. Configure the document build / WebPack.BASE. Conf.js
{Test: /\. (PNG|JPE ?G|GIF|VG) (\?.* )?/, loader: 'URL- Loader ', Exclude: [Resolve (' src / icons')], Options: {Limit: 10000, Name: utils.assetspath ('images / [name]. [hash: 7]. [ext]')}}

2. Picture of a static file, should be placed under this Static folder, the file under this folder (clip ) Will be placed in the website root directory according to the original structure. I am at this time.These static files can be accessed using the / static absolute path. 3. Request data

Created () {const this = this this.Request ({URL: ‘/ sysinfofront / list “, method:’ Get ‘}). Then (Function (res) {const resdata = res. {constata.code ================================================= • Data}}}},
 Request:   

4. Introduction vue src动态加载请求获取图片的方法

Final Image display effect of two ways
  The above is all the content of this article, I hope to help everyone, I hope everyone will support Tumi Clouds.  
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment