myz-img-preview
v0.1.0-beta.2
Published
基于vue的图片预览组件
Downloads
4
Readme
myz-img-preview
Project setup
npm install
Compiles and hot-reloads for development
npm run serve
Compiles and minifies for production
npm run build
Lints and fixes files
npm run lint
Customize configuration
Usage
- 安装
npm install myz-img-preview
- 在 main.js 引入组件包
import myzImgPreview from 'myz-img-preview'
import 'myz-img-preview/dist/myz-img-preview.css'
- 使用 use 注册组件
Vue.use(imgPreview)
- vue中使用
<template>
<img-preview :data="imgs" />
</template>
<script>
export default {
name: 'Test',
data() {
return {
imgs: [
{ src: require('../imgs/test0.jpg'), title: 'test0.jpg' },
{ src: require('../imgs/test1.jpg'), title: 'test1.jpg' },
{ src: require('../imgs/test2.jpg'), title: 'test2.jpg' },
],
}
},
}
</script>
<style lang='scss' scoped>
</style>