@work-zhanguo/light-file-preview 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# @work-zhanguo/light-file-preview
|
|
2
2
|
|
|
3
3
|
Gitee: [https://gitee.com/hou_zhan_guo/light-file-preview](https://gitee.com/hou_zhan_guo/light-file-preview)
|
|
4
|
+
npm:[https://www.npmjs.com/package/@work-zhanguo/light-file-preview](https://www.npmjs.com/package/@work-zhanguo/light-file-preview)
|
|
4
5
|
|
|
5
6
|
## 项目简介
|
|
6
7
|
|
|
@@ -45,6 +46,28 @@ Gitee: [https://gitee.com/hou_zhan_guo/light-file-preview](https://gitee.com/hou
|
|
|
45
46
|
- [marked](https://github.com/markedjs/marked)
|
|
46
47
|
- [DOMPurify](https://github.com/cure53/DOMPurify)
|
|
47
48
|
|
|
49
|
+
## 安装
|
|
50
|
+
|
|
51
|
+
安装组件:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm install @work-zhanguo/light-file-preview
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
如果是 `Vue3` 项目,注册入口:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import LightFilePreview from '@work-zhanguo/light-file-preview';
|
|
61
|
+
import '@work-zhanguo/light-file-preview/style.css';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
如果是 `Vue2` 项目,注册入口:
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
import LightFilePreview from '@work-zhanguo/light-file-preview/vue2';
|
|
68
|
+
import '@work-zhanguo/light-file-preview/style.css';
|
|
69
|
+
```
|
|
70
|
+
|
|
48
71
|
## 远程地址预览
|
|
49
72
|
|
|
50
73
|
通过 `window.open` 传入网络地址,直接打开新页面预览。建议同时传 `name`,这样扩展名识别更稳定。
|
|
@@ -158,6 +181,23 @@ dist/
|
|
|
158
181
|
dist/standalone/
|
|
159
182
|
```
|
|
160
183
|
|
|
184
|
+
如果要把首页演示页和文档页一起部署成静态站点,执行:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
npm run build:site
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
站点部署目录:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
dist-site/
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
其中会包含:
|
|
197
|
+
|
|
198
|
+
- `dist-site/index.html`
|
|
199
|
+
- `dist-site/docs.html`
|
|
200
|
+
|
|
161
201
|
## 接入说明
|
|
162
202
|
|
|
163
203
|
- 本地上传文件只在当前浏览器中预览,不会保存到服务器
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@work-zhanguo/light-file-preview",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "轻量级通用文件预览组件,支持 Vue3、Vue2 适配与独立产物嵌入。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/light-file-preview.umd.cjs",
|
|
@@ -28,8 +28,10 @@
|
|
|
28
28
|
"scripts": {
|
|
29
29
|
"dev": "vite",
|
|
30
30
|
"build": "vite build && vite build --config vite.vue2.config.ts && vite build --config vite.standalone.config.ts && npm run build:types",
|
|
31
|
+
"build:site": "vite build --config vite.site.config.ts",
|
|
31
32
|
"build:types": "vue-tsc -p tsconfig.json --declaration --emitDeclarationOnly --outDir dist/types",
|
|
32
|
-
"preview": "vite preview"
|
|
33
|
+
"preview": "vite preview",
|
|
34
|
+
"preview:site": "vite preview --config vite.site.config.ts --outDir dist-site"
|
|
33
35
|
},
|
|
34
36
|
"keywords": [
|
|
35
37
|
"vue3",
|