slidev-addon-infographic 1.0.0
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 +44 -0
- package/components/Infographic.vue +50 -0
- package/package.json +34 -0
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# slidev-addon-infographic
|
|
2
|
+
|
|
3
|
+
[@antv/infographic](https://infographic.antv.vision/) component for slidev
|
|
4
|
+
|
|
5
|
+
``` sh
|
|
6
|
+
pnpm i slidev-addon-infographic --save
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Add the following to your `slides.md`:
|
|
10
|
+
|
|
11
|
+
``` md
|
|
12
|
+
---
|
|
13
|
+
layout: center
|
|
14
|
+
addons:
|
|
15
|
+
- slidev-addon-infographic
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
<RenderWhen
|
|
19
|
+
:context="['visible', 'print', 'slide', 'overview', 'presenter', 'previewNext']"
|
|
20
|
+
style="height: 100%;">
|
|
21
|
+
<Infographic :data="`infographic list-row-simple-horizontal-arrow
|
|
22
|
+
data
|
|
23
|
+
items
|
|
24
|
+
- label 步骤 1
|
|
25
|
+
desc 开始
|
|
26
|
+
- label 步骤 2
|
|
27
|
+
desc 进行中
|
|
28
|
+
- label 步骤 3
|
|
29
|
+
desc 完成
|
|
30
|
+
`"></Infographic>
|
|
31
|
+
</RenderWhen>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- **Infographic component must be used with RenderWhen component to show infographic in slidev**
|
|
35
|
+
- **The Infographic component must occupy the entire page or be contained within elements with dimensions**
|
|
36
|
+
- **Temporarily supports exporting in PPTX and PNG formats**
|
|
37
|
+
|
|
38
|
+
1. **Infographic组件必须与RenderWhen组件一起使用,才能在幻灯片中显示信息图**
|
|
39
|
+
2. **Infographic组件必须占用整个页面或被包含在带尺寸的元素中**
|
|
40
|
+
3. **暂时支持导出 PPTX, PNG 格式**
|
|
41
|
+
|
|
42
|
+
Edit the [slides.md](./slides.md) to see the changes.
|
|
43
|
+
|
|
44
|
+
Learn more about Slidev at the [documentation](https://sli.dev/).
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="containerRef" style="width: 100%;height: 100%;"></div>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import { useDarkMode } from '@slidev/client'
|
|
7
|
+
import {ref, watch, onMounted, onUnmounted} from 'vue'
|
|
8
|
+
import {Infographic} from '@antv/infographic'
|
|
9
|
+
|
|
10
|
+
const props = defineProps(['data'])
|
|
11
|
+
|
|
12
|
+
const containerRef = ref(null)
|
|
13
|
+
let infographic = null
|
|
14
|
+
const { isDark } = useDarkMode()
|
|
15
|
+
|
|
16
|
+
function initInfographic(data) {
|
|
17
|
+
if (infographic) infographic.destroy()
|
|
18
|
+
infographic = new Infographic({
|
|
19
|
+
container: containerRef.value,
|
|
20
|
+
width: '100%',
|
|
21
|
+
height: '100%',
|
|
22
|
+
})
|
|
23
|
+
data && infographic.render(data)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
onMounted(() => {
|
|
27
|
+
initInfographic(props.data)
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
onUnmounted(() => {
|
|
31
|
+
if (infographic) {
|
|
32
|
+
infographic.destroy()
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
watch(() => props.data, (newData) => {
|
|
37
|
+
newData && initInfographic(newData)
|
|
38
|
+
})
|
|
39
|
+
watch(() => isDark.value, (newDark) => {
|
|
40
|
+
if (newDark) {
|
|
41
|
+
infographic.update({
|
|
42
|
+
theme: 'dark',
|
|
43
|
+
})
|
|
44
|
+
} else {
|
|
45
|
+
infographic.update({
|
|
46
|
+
theme: 'light',
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
</script>
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "slidev-addon-infographic",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"author": "fxss5201",
|
|
6
|
+
"description": "@antv/infographic component for slidev",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git@github.com:fxss5201/slidev-addon-infographic.git"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "slidev build",
|
|
14
|
+
"dev": "slidev --open",
|
|
15
|
+
"export": "slidev export"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@antv/infographic": "^0.2.7"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@slidev/cli": "^52.11.2",
|
|
22
|
+
"@slidev/theme-default": "^0.25.0",
|
|
23
|
+
"@slidev/theme-seriph": "^0.25.0",
|
|
24
|
+
"vue": "^3.5.26"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"slidev",
|
|
28
|
+
"slidev-addon",
|
|
29
|
+
"@antv/infographic"
|
|
30
|
+
],
|
|
31
|
+
"files": [
|
|
32
|
+
"components/Infographic.vue"
|
|
33
|
+
]
|
|
34
|
+
}
|