Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/anranruye/viewerjsblazor

A blazor wrapper for Viewer.js JavaScript image viewer library
https://github.com/anranruye/viewerjsblazor

blazor component image image-viewer razor viewer viewerjs

Last synced: about 2 months ago
JSON representation

A blazor wrapper for Viewer.js JavaScript image viewer library

Awesome Lists containing this project

README

        

# ViewerJsBlazor

A blazor wrapper for [Viewer.js](https://github.com/fengyuanchen/viewerjs) JavaScript image viewer library.

## Installation

By Package Manager:
```
Install-Package ViewerJsBlazor -Version 1.0.0
```

By CLI:
```
dotnet add package ViewerJsBlazor --version 1.0.0
```

By PackageReference:
```

```

## Usage

In your `_Host.cshtml` or `index.html` file:
```html

```

In a razor page:
```html
@using ViewerJsBlazor

@*image group*@

@for (var i = 1; i <= 9; i++)
{




  • }

    @*single image*@

    @code{
    object options = new { url = "data-original" };
    }

    ```

    ## API

    ### `ViewerJsImageGroup`:

    The `ViewerJsImageGroup` component will generate a html element as the container of a group of images.

    ### Properties
    razor attributes:

    Name | type | description

    `ElementType` | `string` | the type of the html element generated by this component, default value is `"div"`

    `Options` | `object` | the options of the viewer, you can use an object of anonymous type or a dictionary, see https://github.com/fengyuanchen/viewerjs#options to learn available options

    All unmatched attributes will added to the generated html element as html attributes.

    ### Methods

    `void Refresh()` | destory and recreate the viewer

    `Task InvokeMethod(string methodName, params object[] paramters)` | invoke a method of the js viewer instance, see https://github.com/fengyuanchen/viewerjs#methods to learn available methods

    ### `ViewerJsImage`:

    The `ViewerJsImage` component will generate an `` element to display an image.

    ### Properties
    razor attributes:

    Name | type | description

    `Options` | `object` | the options of the viewer, you can use an object of anonymous type or a dictionary, see https://github.com/fengyuanchen/viewerjs#options to learn available options

    All unmatched attributes will added to the generated `` element as html attributes.

    ### Methods

    `void Refresh()` | destory and recreate the viewer

    `Task InvokeMethod(string methodName, params object[] paramters)` | invoke a method of the js viewer instance, see https://github.com/fengyuanchen/viewerjs#methods to learn available methods