-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
21,477 additions
and
15,645 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
dist/ | ||
LICENSE.md | ||
pnpm-lock.yaml | ||
pnpm-workspace.yaml | ||
pnpm-workspace.yaml | ||
assets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
pnpm -F ranuts test | ||
pnpm -F ranuts build | ||
# pnpm -F ranui test | ||
pnpm -F ranui test |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
packages/docs/.vitepress/cache/deps/vue.js → ...vitepress/cache/deps_temp_86014631/vue.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...ges/docs/.vitepress/cache/deps/vue.js.map → ...press/cache/deps_temp_86014631/vue.js.map
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,51 @@ | ||
# preview 预览组件 | ||
|
||
支持`docx`,`pptx`,`pdf`文件的预览 | ||
支持`docx`,`pptx`,`pdf`,`xlsx`文件的预览 | ||
|
||
## 代码演示 | ||
|
||
预览`docx` | ||
|
||
<div style="width: 100px;margin-top:10px"> | ||
<r-preview id="docx"><r-icon name="preview" size="30" color="#1E90FF"></r-icon>点击预览</r-preview> | ||
<r-button type="primary" onclick="uploadFile('docx')">上传docx</r-button> | ||
<div style="width: 100px; margin-top:10px"> | ||
<r-preview id="preview"></r-preview> | ||
<r-button type="primary" onclick="uploadFile('preview')">choose file to preview</r-button> | ||
</div> | ||
|
||
```xml | ||
<r-preview >点击预览</r-preview> | ||
<r-button type="primary" onclick="uploadFile()">上传docx</r-button> | ||
```html | ||
<r-preview ></r-preview> | ||
<r-button type="primary" onclick="uploadFile()">上传docx</r-button> | ||
|
||
<script> | ||
const uploadFile = () => { | ||
const preview = document.getElementById('preview') | ||
const uploadFile = document.createElement('input') | ||
uploadFile.setAttribute('type', 'file') | ||
uploadFile.click() | ||
uploadFile.onchange = (e) => { | ||
const { files = [] } = uploadFile | ||
if (files.length > 0) { | ||
preview.setAttribute('src', '') | ||
const file = files[0] | ||
const url = URL.createObjectURL(file) | ||
preview.setAttribute('src', url) | ||
} | ||
} | ||
} | ||
</script> | ||
``` | ||
|
||
预览`pptx` | ||
|
||
<div style="width: 100px;margin-top:10px"> | ||
<r-preview id="pptx"><r-icon name="preview" size="30" color="#1E90FF"></r-icon>点击预览</r-preview> | ||
<r-button type="primary" onclick="uploadFile('pptx')">上传pptx</r-button> | ||
</div> | ||
## 属性 | ||
|
||
```xml | ||
<r-icon name="eye"></r-icon><r-preview >点击预览</r-preview> | ||
<r-button type="primary" onclick="uploadFile()">上传pptx</r-button> | ||
``` | ||
### 资源地址`src` | ||
|
||
预览`pdf` | ||
有 `src` 地址即可打开弹窗,没有`src`就不展示 | ||
|
||
<div style="width: 100px;margin-top:10px"> | ||
<r-preview id="pdf"><r-icon name="preview" size="30" color="#1E90FF"></r-icon>点击预览</r-preview> | ||
<r-button type="primary" onclick="uploadFile('pdf')">上传pptx</r-button> | ||
</div> | ||
|
||
```xml | ||
<r-icon name="eye"></r-icon><r-preview >点击预览</r-preview> | ||
<r-button type="primary" onclick="uploadFile()">上传pdf</r-button> | ||
```html | ||
<r-preview src=""></r-preview> | ||
``` | ||
|
||
## 属性 | ||
|
||
### 预览的文件地址`src` | ||
### 是否可关闭`closeable` | ||
|
||
需要注意的是,链接需要支持跨域,否则请求不了资源 | ||
`closeable` 不设置默认为 `true` ,可以关闭,传 `false` 表示不展示关闭按钮,不可关闭 | ||
|
||
<r-icon name="preview" size="30" color="#1E90FF"></r-icon>点击预览 | ||
<r-preview src="//www.ecma-international.org/wp-content/uploads/ECMA-423_1st_edition_june_2023.pdf"></r-preview> | ||
|
||
```xml | ||
<r-icon name="preview" size="30" color="#1E90FF"></r-icon>点击预览 | ||
<r-preview src="//www.ecma-international.org/wp-content/uploads/ECMA-422_1st_edition_december_2022.pdf"></r-preview> | ||
``` | ||
```html | ||
<r-preview closeable="false"></r-preview> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.