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

zaki-dxp-office-preview

v0.1.1

Published

小俊 · 一站式 Office 在线预览(docx / xlsx / pptx),Vue2 & 3,基于 @vue-office + vue-demi

Readme

zaki-dxp-office-preview

Vue 2 / Vue 3 下一套 API 预览 Word(docx)Excel(xlsx)PPT(pptx)。底层依赖 @vue-officevue-demi,本包只做统一封装与样式入口。

TypeScript 与纯 JavaScript 项目均可使用:发布产物含 ESMimport)与 CommonJSrequire),并带 .d.ts 类型声明(JS 里也能享受编辑器提示)。

安装

npm install zaki-dxp-office-preview [email protected]

项目使用的 Vue 主版本 需与依赖一致。若使用 Vue 2.6 及以下,还需:

npm install @vue/composition-api

安装完成后,各 @vue-office/*postinstall 会按当前环境切换构建产物;若切换异常,可删除 node_modules 后重装。

样式

入口已打包 docx / excel 所需样式;请额外引入本包 CSS(pptx 无独立样式文件)。

ESM(Vite / 现代打包工具):

import "zaki-dxp-office-preview/style.css";

CommonJS:

require("zaki-dxp-office-preview/style.css");

(若构建工具不支持对 css 使用 require,请在入口 HTML 或配置里引入 node_modules/zaki-dxp-office-preview/dist/style.css。)

使用(Vue 3 + <script setup>,纯 JS)

<template>
  <ZakiDocxPreview :src="docxUrl" style="height: 80vh" @rendered="onOk" @error="onErr" />
  <ZakiExcelPreview :src="xlsxUrl" style="height: 80vh" />
  <ZakiPptxPreview :src="pptxUrl" style="height: 80vh" />
  <ZakiOfficePreview type="docx" :src="docxUrl" style="height: 40vh" />
</template>

<script setup>
import {
  ZakiDocxPreview,
  ZakiExcelPreview,
  ZakiPptxPreview,
  ZakiOfficePreview,
} from "zaki-dxp-office-preview";
import "zaki-dxp-office-preview/style.css";

const docxUrl = "https://example.com/demo.docx";
const xlsxUrl = "https://example.com/demo.xlsx";
const pptxUrl = "https://example.com/demo.pptx";

function onOk() {
  console.log("rendered");
}
function onErr(e) {
  console.error(e);
}
</script>

使用(Vue 2 / Vue 3,选项式 API + 纯 JS)

<template>
  <ZakiDocxPreview :src="docx" style="height: 80vh" />
</template>

<script>
import { ZakiDocxPreview } from "zaki-dxp-office-preview";
import "zaki-dxp-office-preview/style.css";

export default {
  components: { ZakiDocxPreview },
  data() {
    return {
      docx: "https://example.com/demo.docx",
    };
  },
};
</script>

使用 TypeScript

<script setup> 写成 lang="ts" 即可,类型从包内导出(如 ZakiOfficeKindZakiOfficeSrc)。

全局注册

ESM:

import { createApp } from "vue";
import ZakiOfficePreviewPlugin from "zaki-dxp-office-preview";
import "zaki-dxp-office-preview/style.css";

const app = createApp(App);
app.use(ZakiOfficePreviewPlugin);

CommonJS(例如部分 Webpack / Vue CLI 配置):

const pkg = require("zaki-dxp-office-preview");
const ZakiOfficePreviewPlugin = pkg.default || pkg;
require("zaki-dxp-office-preview/style.css");

// Vue 3
const { createApp } = require("vue");
const app = createApp(App);
app.use(ZakiOfficePreviewPlugin);

Vue 2:Vue.use(require("zaki-dxp-office-preview").default)

说明: 本库依赖的 @vue-office/* 面向浏览器环境。请在 打包进前端 的流程里使用 require;不要在 纯 Node里直接 require 本包做 SSR 直跑(会缺少 window,除非自行做 mock)。

src 说明

与 vue-office 一致:支持文档 URL 字符串ArrayBufferBlob(如上传、接口二进制)。

许可

MIT。底层库许可见 @vue-office/* 仓库。