vue-larger-image

English | 中文简体
570
Install
npm install vue-larger-image
Latest Version:0.2.3
Vue:2
License:MIT
Last Updated:Mar 30, 2021
Links: npm
Maintainer: lhyunited

vue-larger-image

English | 中文简体

A plugin based on Vuejs, which provides the function of viewing larger image. As view sounds like Vue, so we call it vue-larger-iamge

iamge image

Usage

Option one:

# with npm
npm i vue-larger-image

# with yarn
yarn add vue-larger-iamge

Register in main.js

import VueLargerImage from 'vue-larger-image'
Vue.use(VueLargerImage)

In the component you wish to deploy

<vue-larger-image
  width="200"
  bgColor="rgb(0,0,0,.2)"
  height="auto"
  alt="hello"
  src="https://static.tomluvjerry.cn/files/lhyUnited/2236da75b7fba3b3ff6380242166e9b3.jpg">
</vue-larger-image>

Option two:

import the plugin as Web-component

<script src="https://cdn.jsdelivr.net/npm/vue-larger-image@latest/dist/wc/vue-larger-image.min.js"></script>

Some place where you wish to deploy:

<vue-larger-image
  width="200"
  bgColor="rgb(0,0,0,.2)"
  height="auto"
  alt="hello"
  src="https://static.tomluvjerry.cn/files/lhyUnited/2236da75b7fba3b3ff6380242166e9b3.jpg">
</vue-larger-image>

More about Web-component,please check: https://cli.vuejs.org/zh/guide/build-targets.html#web-components-%E7%BB%84%E4%BB%B6

Props

options type default additional
src String https://i.loli.net/2021/03/29/Hcvo57YUtpGmwdq.jpg DO NOT USE RELATIVE PATH
width String auto width of image
height String auto height of image
bgColor String rgba(0,0,0,.45) the background-color of mask
alt String image something to show when the image crushed
title String ''
srcset String ''

Develop

Clone this repo

git clone git@github.com:lhyUnited/vue-larger-image.git

Start the server

yarn serve

Build

"scripts": {
  "serve": "vue-cli-service serve",
  "lint": "vue-cli-service lint",
  "wc": "rm -rf ./dist/wc/* && vue-cli-service build --target wc --name vue-larger-image --dest dist/wc VueLargerImage/src/index.vue",
  "lib": "rm -rf ./dist/lib/* && vue-cli-service build --target lib --name vue-larger-image --dest dist/lib ./VueLargerImage/index.js",
  "build": "rm -rf ./dist/* && npm run wc && npm run lib",
  "pp": "npm run wc && npm run lib && npm publish --registry http://registry.npmjs.org"
},
/** 
* wc: output expected as Web-component
* lib: output expected as umd
* pp: prepublish
*/

LICENSE

MIT

Related Packages

@scayle/nuxt-image-provider

An image provider to handle SCAYLE-specific modifiers

99,945
modern-filters

Modern filter collection

489 9
vue-to-pdf

一个vue.js的组件,可以将html转化为pdf和图片并进行下载

9,685
@rhapsodic/nuxt-vuewer

Nuxt module for viewing images

4,632 0
vue-image-zoomify

An image zooming feature for Vue, enabling zoom in and out functionalities.

3,332 0

Version History

Version Released Vue License
0.2.3 ^2.6.11 MIT
0.2.2 ^2.6.11 MIT
0.2.1 ^2.6.11 MIT
0.2.0 ^2.6.11 MIT
0.1.9 ^2.6.11 MIT