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 install file-preview ```

  • 0.1.0
  • npm
  • Socket score

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

preview-vue

安装

npm install file-preview

描述

实现了对线上文件和本地上传文件的预览

参数选项

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

示例

点击查看 线上演示.

使用

main.js 中注册全局组件

const FilePreview = require('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];
    },
  },
};

FAQs

Package last updated on 13 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