Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
vue-files-preview
Advanced tools
A tool for previewing files such as doc, excel, pdf, image, markdown, txt, audio, and video and so on.
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/SmallTeddy/vue-files-preview
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
import { createApp } from 'vue'
import App from './App.vue'
import VueFilesPreview from 'vue-files-preview'
import 'vue-files-preview/dist/vue-files-preview.css'
const app = createApp(App)
app.use(VueFilesPreview)
app.mount('#app')
⚠️ If you want import all preview component, you must be import
Vue3FilePreview
like this!
<template>
<VueFilesPreview :upload-file="uploadFile" />
<!-- or -->
<vue-files-preview :upload-file="uploadFile" />
</template>
<script>
import { VueFilesPreview } from 'vue-files-preview'
</script>
<template>
<div class="main-container">
<div v-if="uploadFile" class="preview-container">
<vue-files-preview :upload-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"><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>
import { ref } from "vue";
import { ElUpload } from "element-plus";
import { UploadFilled } from "@element-plus/icons-vue";
const uploadRef = ref();
const uploadFile = ref();
const beforeFileUpload = (rawFile) => {
uploadFile.value = {
name: rawFile.name,
size: rawFile.size,
status: "ready",
uid: rawFile.uid,
raw: rawFile,
};
return false;
};
</script>
This demo is already here vue-files-preview-demo, click to view it.
Be pending
Using Vue Office to implement preview of doc, excel, and pdf files
use nature audio tag and canvas to implement the audio preview
use nature video tag to implement the video preview (just support mp4)
using native img tags to implement image 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
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
using epubjs to adapt to EPUB file preview and configure page-flipping function for secondary development
FAQs
A tool for previewing files such as doc, excel, pdf, image, markdown, txt, audio, and video and so on.
The npm package vue-files-preview receives a total of 771 weekly downloads. As such, vue-files-preview popularity was classified as not popular.
We found that vue-files-preview demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.