Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

还是想问一下这个怎么设置图片 #6

Open
Zoidbergme opened this issue Aug 7, 2018 · 3 comments
Open

还是想问一下这个怎么设置图片 #6

Zoidbergme opened this issue Aug 7, 2018 · 3 comments

Comments

@Zoidbergme
Copy link

看了一下VerifySlide.vue里面似乎是写的“background: 'url(' + imgUrl + imgName[imgRand]+')'”,而imgUrl默认给的是“'http://via.placeholder.com/'”,我想知道假如我想在用本地存储的图片怎么办?我写的是require('../images')这样会报错,写成'require('../images/1.png')'这样的具体的路径才没有报错,但是这样又没法配合后面的imgName参数了。。

@mizuka-wu
Copy link
Owner

比如你把要用的图片都放/static/下面,然后把imgUrl改成/static/

@TempestRise
Copy link

第一步:
将图片一张张的引进来 import img1 from '../../assets/image/1.jpg'
第二步:
在 data 中拼成数组 imgName: [img1,img2,img3,img4,img5,img6,img7,img8]
第三步
将 插件的imgName属性设置成 :imgName = "imgName" imgUrl=""

@zhangyupeng233
Copy link

html中如下
<Verify @success="" @error="" :type="4" :showButton="false" imgUrl="~@/../static/images/" :imgName="imgName">

图片放在static/images中

js里设置图片名称数组
data () {
return {
imgName: ['1.jpg', '2.jpg']
}
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants