All Projects → xiabingwu → react-viewerjs

xiabingwu / react-viewerjs

Licence: MIT License
Image preview;React wrapper for viewerjs

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-viewerjs

vue-active-preview
🌲 A PhotoSwipe Image Preview component for Vue
Stars: ✭ 22 (-40.54%)
Mutual labels:  preview
vim-swagger-preview
A Vim plugin for previewing swagger/openAPI spec in Chrome with swagger-ui.
Stars: ✭ 19 (-48.65%)
Mutual labels:  preview
cordova-plugin-foxitpdf
Cordova plugin for Foxit PDF SDK to View PDF Files
Stars: ✭ 19 (-48.65%)
Mutual labels:  preview
vscode-svg-preview
Svg Preview for VSCode
Stars: ✭ 27 (-27.03%)
Mutual labels:  preview
file-upload-with-preview
🖼 Simple file-upload utility that shows a preview of the uploaded image. Written in TypeScript. No dependencies. Works well with or without a framework.
Stars: ✭ 406 (+997.3%)
Mutual labels:  preview
android-word2html
android word文档预览 基于poi的word(.doc/.docx)转html 实现预览功能
Stars: ✭ 38 (+2.7%)
Mutual labels:  preview
react-hover-video-player
A React component for rendering videos that play on hover, including support for mouse and touch events and a simple API for adding thumbnails and loading states.
Stars: ✭ 60 (+62.16%)
Mutual labels:  preview
vimpreviewpandoc
VIM plugin for markup editing with live preview
Stars: ✭ 47 (+27.03%)
Mutual labels:  preview
markdown-preview-sync
A quasi real-time vim markdown preview plugin | 第一款基于Java的Vim Markdown预览插件
Stars: ✭ 56 (+51.35%)
Mutual labels:  preview
rstpad
Standalone reStructuredText editor with live preview (native app)
Stars: ✭ 35 (-5.41%)
Mutual labels:  preview
mup
A markup previewer
Stars: ✭ 38 (+2.7%)
Mutual labels:  preview
ISVImageScrollView
Image preview component with zoom, scroll and rotation support
Stars: ✭ 28 (-24.32%)
Mutual labels:  preview
sneakpeek
Reddit bot to preview and post hyperlinks as comments
Stars: ✭ 60 (+62.16%)
Mutual labels:  preview
react-file-input-previews-base64
This package provides an easy to use, ready to go and customizable wrapper around file input, with option for image previews and returning file as base64 string.
Stars: ✭ 15 (-59.46%)
Mutual labels:  preview
quickmd
Quickly preview a markdown file
Stars: ✭ 24 (-35.14%)
Mutual labels:  preview
video-snapshot
Get snapshots from a video file in the browser 🎥 🌅
Stars: ✭ 63 (+70.27%)
Mutual labels:  preview
imgcat
Display images and gifs in your terminal.
Stars: ✭ 67 (+81.08%)
Mutual labels:  preview
previewSlider
Responsive fullscreen image slider where the users are able to preview next/previous image when hovering over the navigation arrows.
Stars: ✭ 16 (-56.76%)
Mutual labels:  preview
urlbox-screenshots-node
Capture website thumbnails using the urlbox.io screenshot as a service API in node
Stars: ✭ 14 (-62.16%)
Mutual labels:  preview
vuepress-plugin-example-preview
Easily display the preview of a code snippet
Stars: ✭ 15 (-59.46%)
Mutual labels:  preview

react-viewerjs

View README in English

图片预览;对viewerjs库的react封装

安装

npm i react-viewerjs

API

RViewer组件配置参数

参数 说明 类型 默认值 是否必须
imageUrls 单张图片预览地址(使用字符串)或者多张图片预览地址集合(使用数组) string|array undefined
options 预览配置参见(viewerjs options object undefined

RViewerTrigger组件说明

该组件只有一个元素,用于触发图片预览

参数 说明 类型 默认值 是否必须
index 预览触发显示索引为index图片,默认为0,显示第一张 number 0

例子

  • 基础

import React from "react"
import { RViewer, RViewerTrigger } from '../react-viewerjs'
const OneImagePreview = () => {
  let sourceUrl = "./imgs/1.jpg"
  let options={
    toolbar: {//单张图片预览不要pre和next底部按钮,隐藏它
      prev: false,
      next: false
    }
  }
  return (
    <RViewer options={options} imageUrls={sourceUrl}>
      <RViewerTrigger>
        <button>one image preview</button>
      </RViewerTrigger>
    </RViewer>
  )
}
const MultiImagePreview = () => {
  let sourceUrl = ["./imgs/1.jpg","./imgs/2.jpg","./imgs/3.jpg","./imgs/4.jpg","./imgs/5.jpg"]
  return (
    <RViewer imageUrls={sourceUrl}>
      <RViewerTrigger>
        <button>Multiple images preview</button>
      </RViewerTrigger>
    </RViewer>
  )
}
const BaseDemoComponent = () => {
  
  return (
    <div>
      <OneImagePreview />
      <MultiImagePreview />
    </div>
  )
};
ReactDOM.render(<BaseDemoComponent />, document.getElementById('root'));

https://xiabingwu.github.io/react-viewerjs/#/

  • 列表

import React from "react"
import { RViewer, RViewerTrigger } from '../react-viewerjs'
const ListDemoComponent = () => {
  let sourceImageUrls = [
    "./imgs/1.jpg",
    "./imgs/2.jpg",
    "./imgs/3.jpg",
    "./imgs/4.jpg",
    "./imgs/5.jpg"
  ]
  let thumbImageUrls = sourceImageUrls//小图和原图一样,只是为了演示方便
  return (
    <RViewer imageUrls={sourceImageUrls}>
      <ul>
        {thumbImageUrls.map((pic, index) => {
          return (
            <li  key={index} style={{marginBottom:"20PX"}}>
              <span>image {index+1}</span>
              {/*这里需要设置index值,告知触发图片预览该显示哪张图片*/}
              <RViewerTrigger index={index}>
                <img src={pic} style={{width:"50px",verticalAlign:"middle"}}  />
              </RViewerTrigger>
            </li>
          )
        })
        }
      </ul>
    </RViewer>
  )
};
ReactDOM.render(<ListDemoComponent />, document.getElementById('root'));

https://xiabingwu.github.io/react-viewerjs/#/list

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].