1.1.0 • Published 6 months ago

vue-image-preview-component v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

vue-image-preview-component

📎 Installation

$ npm i vue-image-preview-component
# or
$ yarn add vue-image-preview-component

👽 Usage

main.js:

import Vue from "vue";
import App from "./App.vue";
Vue.config.productionTip = false;

import VueImagePreview from "vue-image-preview-component";
import 'vue-image-preview-component/dist/vue-image-preview.css'
Vue.use(VueImagePreview);

new Vue({
  render: (h) => h(App),
}).$mount("#app");

App.vue:

<template>
  <div id="app">
    <button class="btn" @click="open">预览</button>
    <VueImagePreview
      v-if="isShow"
      :bgColor="'rgba(255,255,255,.2)'"
      :urlList="imgList"
      :onClose="close"
      drag
      download
    ></VueImagePreview>
  </div>
</template>

<script>

/**
 * test
 */
export default {
  name: "App",
  data() {
    return {
      imgList: [],
      isShow: false,
    };
  },
  methods: {
    open(e) {
      e.preventDefault();
      this.isShow = true;
    },
    close() {
      this.isShow = false;
    },
  },
};
</script>

📁 Options

keydescriptiondefaulttype
urlListThe image used when the image is loaded-Array
bgColorOverwrite Preview Background#fffString
dragCan images be dragged and droppedfalseBoolean
downloadCan images be downloadedfalseBoolean
onCloseClose Preview View-Function
1.1.0

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago