npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-files-preview

v1.0.32

Published

A tool for previewing files such as doc, excel, pdf, image, markdown, txt, audio, and video and so on.

Downloads

310

Readme

📖 Introduce

This project is dedicated to previewing any file format on the Vue3 framework, supporting file previews such as docx, xlsx, pdf, image, txt, epub, markdown, code, etc

Project repository: https://github.com/VueFilesPreview/vue-files-preview

🚀 Features

  • [ ] Feat CDN support
  • [ ] Reconfiguration docx-preview
  • [ ] Reconfiguration excel-preview
  • [x] Reconfiguration pdf-preview
  • [ ] Support Success and Error callbacks
  • [ ] Friendly interface for unknown file

📦 Install

From v1.0.0 version

It only works for Vue 3

# npm install
npm i vue-files-preview
# yarn install
yarn add vue-files-preview
# pnpm install
pnpm i vue-files-preview

In Main.js

import {
  createApp
} from 'vue'
import VueFilesPreview from 'vue-files-preview'
import App from './App.vue'
import 'vue-files-preview/lib/style.css'

const app = createApp(App)
app.use(VueFilesPreview)
app.mount('#app')

In Component

⚠️ If you want import all preview component, you must be import VueFilePreview like this!

<template>
  <VueFilesPreview :file="file" />
  <!-- or -- >
  <vue-files-preview :file="file" />
</template>

<script >
  import { VueFilesPreview } from 'vue-files-preview';
</script>

🦄 Demo

Code

<template>
  <div class="main-container">
    <div v-if="uploadFile" class="preview-container">
      <VueFilesPreview :file="uploadFile" />
    </div>
    <div v-else class="upload-btn">
      <el-upload
        ref="uploadRef"
        drag
        action="null"
        :limit="1"
        :before-upload="beforeFileUpload"
      >
        <el-icon class="el-icon--upload"><i-ep-upload-filled /></el-icon>
        <div class="el-upload__text">Drop file here or <em>click to upload</em></div>
      </el-upload>
    </div>
  </div>
</template>

<script lang="ts" setup>
const uploadRef = ref();
const uploadFile = ref();

const beforeFileUpload = (rawFile) => {
  uploadFile.value = rawFile;
  return false;
};
</script>

Page

测试默认界面

This demo is already here vue-files-preview-demo, click to view it.

doc、xls、ppt preview

Be pending

docx、xlsx、pdf preview

Using Vue Office to implement preview of doc, excel, and pdf files

audio、video preview

use nature audio tag and canvas to implement the audio preview

audio preview

use nature video tag to implement the video preview (just support mp4)

video preview

image preview

using native img tags to implement image preview

txt preview

txt preview

code preview

using codemirror to adapt the code file preview, support Angular, CSS, C++, Go, HTML, Java, JavaScript, JSON, Liquid, Markdown, PHP, Python, Rust, Sass, Vue, XML, YAML, C#, CMake, CoffeeScript, Dart, Elixir, GLSL, Haskell, Lua, Objective-C, R, Ruby, Scala, Shell, Swift, TeX, TypeScript, Visual Basic code file preview

markdown preview

I have tried using both the marked and commonmark.js tool libraries for simple implementation, and ultimately adopted the markdown-it tool library

Currently, there may still be issues with formulas and other aspects, which will be further optimized in the future

markdown preview

epub preview

using epubjs to adapt to EPUB file preview and configure page-flipping function for secondary development

epub preview

🌸 Thanks