Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

the-file-preview

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

the-file-preview

## 安装 ``` npm i the-file-preview ```

  • 0.2.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

preview-vue

安装

npm i the-file-preview

描述

支持vue2和vue3,实现了对线上文件和本地上传文件的预览

参数选项

参数类型描述
urlString线上文件的url
fileFile本地的上传文件

示例

点击查看 线上演示.

项目地址

  • github
  • npm

使用

main.js 中注册全局组件

import FilePreview from 'the-file-preview';
Vue.component('FilePreview',FilePreview);
  1. 当使用线上url预览时
<template>
    <filePreview :url="url"/>
</template>
  1. 当预览本地文件时
<template>
    <div class="upload">
      要上传的文件: <input type="file" @change="uploadHandle"/>
    </div>
    <filePreview :file="file"/>
</template>

export default {
  name: 'Demo',
  data() {
    return {
      file: null,
    };
  },
  methods: {
    uploadHandle(data){
      this.file = data.target.files[0];
    },
  },
};

Keywords

FAQs

Package last updated on 14 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc