@gin-test/img
v1.0.0
Published
图片资源
Downloads
5
Readme
图片资源
为了应对后续可能出现的小程序端,特地将图片资源单独部署(小程序端有包体积限制)
保存静态图片资源
- 每个项目单独使用一个一级目录,该目录名需要与项目名保持一致
- 推荐每个页面再单独创建一个二级目录,名字保持一致,该页面所有的图片都放里面
使用图片
在 ts 中使用
import imgHost from '@gin/img'
const url = imgHost('/path/to/img.png')
在模板中使用
<div>这是一张图 <img :src='imgHost('/path/to/img.png')'></div>
在 scss 中使用
.imgDiv {
background: url($imgHost + '/path/to/img.png');
}