Giter Club home page Giter Club logo

duo-image-viewer's Introduction

一个简洁的图片查看器(支持多图记忆)

目录

快速入门

安装

$ npm i duo-image-viewer --save             # install duo-image-viewer   

用法

main.js 文件:

import duoImageViewer from 'duo-image-viewer'

Vue.use(duoImageViewer)

使用:

<template>
  <div>
    <button @click="handleOpen">打开查看器</button>
    <duo-image-viewer 
      :list="srcList"
      @open="openCallback"
      @close="closeCallback"
      :show.sync="showViewer"
      :currentIndex="currentIndex"
    />
  </div>
</template>
<script>
export default {
  data() {
    return {
      currentIndex: 0, // 打开图片查看器时,需要定位到的图片的索引
      srcList: [
        "https://scpic.chinaz.net/files/pic/pic9/202203/apic39703.jpg",
        "https://scpic.chinaz.net/files/pic/pic9/202005/zzpic24899.jpg",
        "https://scpic.chinaz.net/files/pic/pic9/202109/bpic24244.jpg",
        "https://scpic.chinaz.net/files/pic/pic9/202110/hpic4529.jpg",
        "https://scpic.chinaz.net/files/pic/pic9/201912/zzpic22106.jpg",
        "https://scpic.chinaz.net/files/pic/pic9/202202/apic38580.jpg",
      ], // 图片查看器数据集
      showViewer: false, // 是否打开图片查看器
    };
  },
  methods: {
    handleOpen() {
      this.showViewer = true;
    },
    openCallback() {}, // 打开时的回调
    closeCallback() {}, // 关闭时的回调
  }
};
</script>

→ simple demo

维护者

duo-image-viewer's People

Contributors

i-am-a-christians avatar duofuni avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.