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 🙏

© 2026 – Pkg Stats / Ryan Hefner

co-preview-v2

v1.1.7

Published

预览组件

Downloads

6

Readme

co-preview (支持预览图片,pdf 文件,excel 文件,word 文件,txt文件,开启下载属性后支持多种文件格式下载 )(以兼容到 IE11)

1. 安装组件

npm i co-preview

2. 引用组件,全局注册当前组件

import coPreview from 'co-preview'

Vue.use(coPreview)

3. co-preview 在项目内使用

| 参数 | 说明 | 类型 | 可选值 | 默认值 | | :---- | :-------------------------------------------------------: | :------: | :-------------------: | :--------------------------: | | url | 需要预览的文件地址(必传参数) | string | - | - | | width | 预览弹层宽度(非必传) | string | - | 60% | | title | 自定义标题(非必传) | string | - | 预览图片/预览 pdf/预览 excel | | top | 弹层距离顶部距离 | string | - | | - | type | 当 url 地址不含后缀时使用 type 属性(url 地址无后缀必传) | string | jpg/png/jpeg/pdf/xlsx/txt | - | | layer | 是否在弹框内展示 | Boolean | true/false | false | | download | 是否开启下载 | Boolean | true/false | false | | fileName | 文件下载时是否自定义下载时的文件名称(只在下载文件时起作用) | string | - | - | | slot | 插槽 | - | - | - | - | @urlF | 预览关闭回调函数 | function | - | - |

<template>
  <div>
  <co-preview v-model="url" width="60%" title="预览" type="png" layer></co-preview>
  </div>
</template>

export default {
  data() {
    return {
      url: ''
    }
  }
}
<template>
  <div>
  <co-preview v-model="url" width="60%" title="预览" type="png" layer>
  //弹层内具名插槽
  <span slot="dialog-slot">插槽</span>
  //弹层外匿名插槽(一般作为特别的提示使用可以加新的弹层)
  <span>插槽</span>
  </co-preview>
  </div>
</template>

export default {
  data() {
    return {
      url: ''
    }
  }
}

1.0.5版本

问题:

  • 1、解决了预览大写PDF报错问题

  • 2、暂未解决无法预览.doc文件的问题

1.0.6版本

问题:

  • 1、解决了除.doc外其他文件预览报错问题
  • 2、暂未解决无法预览.doc文件的问题

1.0.9版本

问题:

  • 1、增加txt文件预览已完成
  • 2、修改pdf预览方式,兼容河北签章

1.1.1版本

问题:

  • 1、预览doc文件增加提示不支持的提示
  • 2、暂未解决无法预览.doc文件的问题

1.1.2版本

问题:

  • 1、增加插槽
  • 2、暂未解决无法预览.doc文件的问题

1.1.4版本

问题:

  • 1、增加下载文件自命名(fileName)
  • 2、暂未解决无法预览.doc文件的问题

1.1.5版本

问题:

  • 1、增加对ppt、xls 预览提示下载
  • 2、暂未解决无法预览.doc文件的问题

1.1.6版本

问题:

  • 1、解决不能重复下载 doc、ppt、xls 类型文件

1.1.7版本

问题:

  • 1、解决空值不清空预览问题
  • 2、暂未解决无法预览.doc文件的问题