st-comp 0.0.3 → 0.0.5
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 +6 -16
- package/auto-imports.d.ts +9 -0
- package/components.d.ts +23 -0
- package/lib/bundle.js +13634 -906
- package/lib/bundle.umd.cjs +32 -4
- package/lib/style.css +1 -0
- package/package.json +12 -4
- package/packages/Button/index.ts +0 -2
- package/packages/Echarts/index.ts +8 -0
- package/packages/Echarts/index.vue +110 -0
- package/packages/Kline/components/Tips/index.vue +104 -0
- package/packages/Kline/index.ts +8 -0
- package/packages/Kline/index.vue +128 -0
- package/packages/Kline/kline_theme_dark.json +30 -0
- package/packages/Kline/kline_theme_light.json +30 -0
- package/packages/Kline/type.d.ts +14 -0
- package/packages/Kline/utils.ts +158 -0
- package/packages/List/index.ts +8 -0
- package/packages/List/index.vue +1 -1
- package/packages/Table/components/Button/index.vue +54 -0
- package/packages/Table/components/Formatter/index.vue +26 -0
- package/packages/Table/index.ts +8 -0
- package/packages/Table/index.vue +112 -0
- package/packages/index.ts +8 -0
- package/src/App.vue +2 -12
- package/src/components/Echarts/index.vue +31 -0
- package/src/components/Kline/index.vue +17 -0
- package/src/components/Table/index.vue +27 -0
- package/src/main.ts +2 -1
- package/src/style.css +0 -80
- package/vite.config.ts +14 -4
- package/src/components/HelloWorld.vue +0 -38
- /package/packages/{List/index.js → Table/index.d.ts} +0 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import axios from 'axios'
|
|
2
|
+
import type { KlineDataItem, IndicatorDataItem, InOption } from './type.d.ts'
|
|
3
|
+
|
|
4
|
+
// 获取k线数据
|
|
5
|
+
export const getKline = (code: string, bar_count: number, dt: string, frequency: string) => {
|
|
6
|
+
return axios(`http://116.62.161.92:8005/history_kline?code=${code}&bar_count=${bar_count}&dt=${dt}&frequency=${frequency}`)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// 获取指标线列表
|
|
10
|
+
export const getIndicatorList = () => {
|
|
11
|
+
return axios('http://116.62.161.92:8005/get_indicator')
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// 获取指标线数据
|
|
15
|
+
export const getIndicator = (code: string, start_date: string, end_date: string, frequency: string, indicator: string) => {
|
|
16
|
+
return axios(`http://116.62.161.92:8005/realtime_indicator?code=${code}&start_date=${start_date}&end_date=${end_date}&indicator=${indicator}&frequency=${frequency}`)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export const formatValue = (value: number) => {
|
|
21
|
+
return value || value === 0 ? Math.round(value * 1000) / 1000 : null
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const formatPrice = (value: number) => {
|
|
25
|
+
if (value >= 1000000000000) {
|
|
26
|
+
return `${(value / 1000000000000).toFixed(2)}万亿`
|
|
27
|
+
} else if (value >= 100000000) {
|
|
28
|
+
return `${(value / 100000000).toFixed(2)}亿`
|
|
29
|
+
} else if (value >= 10000) {
|
|
30
|
+
return `${(value / 10000).toFixed(2)}万`
|
|
31
|
+
} else {
|
|
32
|
+
return value.toFixed(2)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const getOption = async(data: InOption) => {
|
|
37
|
+
const {
|
|
38
|
+
kLineData,
|
|
39
|
+
indicatorData,
|
|
40
|
+
indicator,
|
|
41
|
+
indicatorList,
|
|
42
|
+
defaultShowBarCount
|
|
43
|
+
} = data
|
|
44
|
+
// 处理k线数据,x轴数据
|
|
45
|
+
const candlestickData: any[] = [] // k线数据
|
|
46
|
+
const xAxisData: number[] = [] // x轴数据
|
|
47
|
+
const kLineLength = kLineData.length // k线条数
|
|
48
|
+
|
|
49
|
+
kLineData.forEach((item: KlineDataItem) => {
|
|
50
|
+
candlestickData.push([
|
|
51
|
+
formatValue(item[1]),
|
|
52
|
+
formatValue(item[4]),
|
|
53
|
+
formatValue(item[3]),
|
|
54
|
+
formatValue(item[2]),
|
|
55
|
+
])
|
|
56
|
+
xAxisData.push(item[0])
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
// 处理指标线数据
|
|
60
|
+
const indicatorInfo = indicatorList[indicator]
|
|
61
|
+
const lineSeries = Object.keys(indicatorData[0]).filter(i => i !== 'datetime').map((key: string) => {
|
|
62
|
+
let color = 'rgba(238, 238, 238, 0.5)'
|
|
63
|
+
if (indicatorInfo && indicatorInfo[key]) {
|
|
64
|
+
color = `#${indicatorInfo[key].split('#')[1]}`
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
name: key,
|
|
68
|
+
type: 'line',
|
|
69
|
+
symbol: 'none',
|
|
70
|
+
data: indicatorData.map(i => i[key]),
|
|
71
|
+
lineStyle: {
|
|
72
|
+
width: 1,
|
|
73
|
+
},
|
|
74
|
+
itemStyle: {
|
|
75
|
+
color,
|
|
76
|
+
},
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
dataset: {
|
|
82
|
+
id: 'data',
|
|
83
|
+
source: {
|
|
84
|
+
kLineData,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
grid: {
|
|
88
|
+
left: '60px',
|
|
89
|
+
top: '40px',
|
|
90
|
+
right: '60px',
|
|
91
|
+
bottom: '30px',
|
|
92
|
+
},
|
|
93
|
+
tooltip: {
|
|
94
|
+
trigger: 'axis',
|
|
95
|
+
showContent: false,
|
|
96
|
+
axisPointer: {
|
|
97
|
+
type: 'cross',
|
|
98
|
+
label: {
|
|
99
|
+
formatter: (data: any) => {
|
|
100
|
+
const { axisDimension, value } = data
|
|
101
|
+
if(axisDimension === 'x') {
|
|
102
|
+
return value
|
|
103
|
+
} else {
|
|
104
|
+
return String(formatValue(value))
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
xAxis: {
|
|
111
|
+
type: 'category',
|
|
112
|
+
data: xAxisData,
|
|
113
|
+
splitLine: {
|
|
114
|
+
show: true,
|
|
115
|
+
lineStyle: {
|
|
116
|
+
type: 'dotted',
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
axisLabel: {
|
|
120
|
+
show: true,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
yAxis: [
|
|
124
|
+
{
|
|
125
|
+
index: 0,
|
|
126
|
+
min: 'dataMin',
|
|
127
|
+
axisLine: {
|
|
128
|
+
show: true,
|
|
129
|
+
},
|
|
130
|
+
splitLine: {
|
|
131
|
+
show: true,
|
|
132
|
+
lineStyle: {
|
|
133
|
+
type: 'dotted',
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
axisLabel: {
|
|
137
|
+
formatter: (value: number) => formatValue(value)
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
dataZoom: [
|
|
142
|
+
{
|
|
143
|
+
type: 'inside',
|
|
144
|
+
xAxisIndex: [0, 0],
|
|
145
|
+
startValue: kLineLength >= defaultShowBarCount ? kLineLength - defaultShowBarCount : 0,
|
|
146
|
+
endValue: kLineLength - 1,
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
series: [
|
|
150
|
+
{
|
|
151
|
+
name: 'k线',
|
|
152
|
+
type: 'candlestick',
|
|
153
|
+
data: candlestickData,
|
|
154
|
+
},
|
|
155
|
+
...lineSeries,
|
|
156
|
+
],
|
|
157
|
+
}
|
|
158
|
+
}
|
package/packages/List/index.vue
CHANGED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<template v-if="show">
|
|
3
|
+
<el-popconfirm
|
|
4
|
+
v-if="option.needCheck"
|
|
5
|
+
:title="option.needCheck.title"
|
|
6
|
+
@confirm="option.onClick(scope.row, scope.$index)"
|
|
7
|
+
>
|
|
8
|
+
<template #reference>
|
|
9
|
+
<el-button
|
|
10
|
+
:type="option.type"
|
|
11
|
+
:disabled="typeof option.disabled === 'function' ? option.disabled(scope.row, scope.$index) : option.disabled"
|
|
12
|
+
>
|
|
13
|
+
{{ typeof option.text === 'function' ? option.text(scope.row, scope.$index) : option.text }}
|
|
14
|
+
</el-button>
|
|
15
|
+
</template>
|
|
16
|
+
</el-popconfirm>
|
|
17
|
+
<el-button
|
|
18
|
+
v-else
|
|
19
|
+
:type="option.type"
|
|
20
|
+
:disabled="typeof option.disabled === 'function' ? option.disabled(scope.row, scope.$index) : option.disabled"
|
|
21
|
+
@click="option.onClick(scope.row, scope.$index)"
|
|
22
|
+
>
|
|
23
|
+
{{ typeof option.text === 'function' ? option.text(scope.row, scope.$index) : option.text }}
|
|
24
|
+
</el-button>
|
|
25
|
+
</template>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup lang="ts">
|
|
29
|
+
import { computed } from 'vue'
|
|
30
|
+
|
|
31
|
+
const props = defineProps({
|
|
32
|
+
option: {
|
|
33
|
+
type: Object,
|
|
34
|
+
required: true
|
|
35
|
+
},
|
|
36
|
+
scope: {
|
|
37
|
+
type: Object,
|
|
38
|
+
required: true
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const show = computed(() => {
|
|
43
|
+
const { option, scope } = props
|
|
44
|
+
if(typeof option.show === 'function') {
|
|
45
|
+
return option.show(scope.row, scope.$index)
|
|
46
|
+
} else if (option.show === false) {
|
|
47
|
+
return false
|
|
48
|
+
}
|
|
49
|
+
return true
|
|
50
|
+
})
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<style lang="scss" scoped>
|
|
54
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:style="typeof option.style === 'function' ? option.style(scope.row[option.prop], scope.row) : option.style"
|
|
4
|
+
>
|
|
5
|
+
{{
|
|
6
|
+
typeof option.formatter === 'function' ? option.formatter(scope.row[option.prop], scope.row) : scope.row[option.prop]
|
|
7
|
+
}}
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
|
|
13
|
+
defineProps({
|
|
14
|
+
option: {
|
|
15
|
+
type: Object,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
scope: {
|
|
19
|
+
type: Object,
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<style lang="scss" scoped>
|
|
26
|
+
</style>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-table
|
|
3
|
+
v-loading="loading"
|
|
4
|
+
:data="data"
|
|
5
|
+
stripe
|
|
6
|
+
style="width: 100%"
|
|
7
|
+
@sort-change="sortChange"
|
|
8
|
+
>
|
|
9
|
+
<el-table-column
|
|
10
|
+
v-for="item in columnConfig"
|
|
11
|
+
:key="item.prop"
|
|
12
|
+
:prop="item.prop"
|
|
13
|
+
:label="item.label"
|
|
14
|
+
:sortable="item.sortable"
|
|
15
|
+
:width="item.width"
|
|
16
|
+
:min-width="item.minWidth"
|
|
17
|
+
>
|
|
18
|
+
<template
|
|
19
|
+
v-if="item.type === 'formatter'"
|
|
20
|
+
#default="scope"
|
|
21
|
+
>
|
|
22
|
+
<Formatter
|
|
23
|
+
:option="item"
|
|
24
|
+
:scope="scope"
|
|
25
|
+
/>
|
|
26
|
+
</template>
|
|
27
|
+
<template
|
|
28
|
+
v-else-if="item.type === 'slot'"
|
|
29
|
+
#default="scope"
|
|
30
|
+
>
|
|
31
|
+
<slot
|
|
32
|
+
:name="item.slot"
|
|
33
|
+
:row="scope.row"
|
|
34
|
+
/>
|
|
35
|
+
</template>
|
|
36
|
+
<template
|
|
37
|
+
v-else-if="item.type === 'btns'"
|
|
38
|
+
#default="scope"
|
|
39
|
+
>
|
|
40
|
+
<template
|
|
41
|
+
v-for="(btn, btnIndex) in item.btns"
|
|
42
|
+
:key="`${btn.text}-${btnIndex}`"
|
|
43
|
+
>
|
|
44
|
+
<el-popover
|
|
45
|
+
v-if="btn.children"
|
|
46
|
+
placement="bottom"
|
|
47
|
+
trigger="hover"
|
|
48
|
+
:popper-style="{ minWidth: '0px', width: null }"
|
|
49
|
+
>
|
|
50
|
+
<template #reference>
|
|
51
|
+
<el-icon
|
|
52
|
+
:style="{ marginLeft: '10px', verticalAlign: '-5px', cursor: 'pointer' }"
|
|
53
|
+
size="20"
|
|
54
|
+
>
|
|
55
|
+
<MoreFilled />
|
|
56
|
+
</el-icon>
|
|
57
|
+
</template>
|
|
58
|
+
<div
|
|
59
|
+
v-for="(subBtn, subBtnIndex) in btn.children"
|
|
60
|
+
:key="`${subBtn.text}-${subBtnIndex}`"
|
|
61
|
+
:style="{ marginTop: subBtnIndex === 0 ? 0 : '10px'}"
|
|
62
|
+
>
|
|
63
|
+
<Button
|
|
64
|
+
:option="subBtn"
|
|
65
|
+
:scope="scope"
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
</el-popover>
|
|
69
|
+
<Button
|
|
70
|
+
v-else
|
|
71
|
+
:option="btn"
|
|
72
|
+
:scope="scope"
|
|
73
|
+
/>
|
|
74
|
+
</template>
|
|
75
|
+
</template>
|
|
76
|
+
</el-table-column>
|
|
77
|
+
</el-table>
|
|
78
|
+
</template>
|
|
79
|
+
|
|
80
|
+
<script setup lang="ts">
|
|
81
|
+
import { computed } from 'vue'
|
|
82
|
+
import { MoreFilled } from '@element-plus/icons-vue'
|
|
83
|
+
import Button from './components/Button/index.vue'
|
|
84
|
+
import Formatter from './components/Formatter/index.vue'
|
|
85
|
+
|
|
86
|
+
const emit = defineEmits(['sortChange'])
|
|
87
|
+
const props = defineProps({
|
|
88
|
+
data: {
|
|
89
|
+
type: Array,
|
|
90
|
+
default: () => []
|
|
91
|
+
},
|
|
92
|
+
column: {
|
|
93
|
+
type: Array,
|
|
94
|
+
default: () => []
|
|
95
|
+
},
|
|
96
|
+
loading: {
|
|
97
|
+
type: Boolean,
|
|
98
|
+
default: () => false
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
const columnConfig: any = computed(() => {
|
|
103
|
+
return props.column.filter((i: any) => i.show !== false)
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
const sortChange = (params: any) => {
|
|
107
|
+
emit('sortChange', params)
|
|
108
|
+
}
|
|
109
|
+
</script>
|
|
110
|
+
|
|
111
|
+
<style lang="scss" scoped>
|
|
112
|
+
</style>
|
package/src/App.vue
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import Button from '../packages/Button/index.vue'
|
|
4
|
-
import List from '../packages/List/index.vue'
|
|
2
|
+
import Table from './components/Table/index.vue'
|
|
5
3
|
</script>
|
|
6
4
|
|
|
7
5
|
<template>
|
|
8
6
|
<div>
|
|
9
|
-
<
|
|
10
|
-
<img src="/vite.svg" class="logo" alt="Vite logo" />
|
|
11
|
-
</a>
|
|
12
|
-
<a href="https://vuejs.org/" target="_blank">
|
|
13
|
-
<img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
|
|
14
|
-
<Button></Button>
|
|
15
|
-
<List></List>
|
|
16
|
-
</a>
|
|
7
|
+
<Table />
|
|
17
8
|
</div>
|
|
18
|
-
<HelloWorld msg="Vite + Vue" />
|
|
19
9
|
</template>
|
|
20
10
|
|
|
21
11
|
<style scoped>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :style="{ width: '400px', height: '400px' }">
|
|
3
|
+
<st-echarts
|
|
4
|
+
:option="option"
|
|
5
|
+
/>
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
import { ref } from 'vue'
|
|
11
|
+
|
|
12
|
+
const option = ref({
|
|
13
|
+
xAxis: {
|
|
14
|
+
type: 'category',
|
|
15
|
+
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
|
16
|
+
},
|
|
17
|
+
yAxis: {
|
|
18
|
+
type: 'value'
|
|
19
|
+
},
|
|
20
|
+
series: [
|
|
21
|
+
{
|
|
22
|
+
data: [150, 230, 224, 218, 135, 147, 260],
|
|
23
|
+
type: 'line'
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
})
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<style scoped>
|
|
30
|
+
|
|
31
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :style="{ width: '50%', height: '600px' }">
|
|
3
|
+
<st-kline
|
|
4
|
+
code="ao8888.SHFE"
|
|
5
|
+
endTime="2023-10-13T16:24:28"
|
|
6
|
+
indicator="DKX_EMA"
|
|
7
|
+
frequency="1m"
|
|
8
|
+
/>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<style scoped>
|
|
16
|
+
|
|
17
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :style="{ width: '50%', height: '600px' }">
|
|
3
|
+
<st-table
|
|
4
|
+
:data="data"
|
|
5
|
+
:column="column"
|
|
6
|
+
/>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
const data = [
|
|
12
|
+
{ name: 'name1' },
|
|
13
|
+
{ name: 'name2' },
|
|
14
|
+
{ name: 'name3' },
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
const column = [
|
|
18
|
+
{
|
|
19
|
+
label: '名称',
|
|
20
|
+
prop: 'name',
|
|
21
|
+
},
|
|
22
|
+
]
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<style scoped>
|
|
26
|
+
|
|
27
|
+
</style>
|
package/src/main.ts
CHANGED
package/src/style.css
CHANGED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
3
|
-
line-height: 1.5;
|
|
4
|
-
font-weight: 400;
|
|
5
|
-
|
|
6
|
-
color-scheme: light dark;
|
|
7
|
-
color: rgba(255, 255, 255, 0.87);
|
|
8
|
-
background-color: #242424;
|
|
9
|
-
|
|
10
|
-
font-synthesis: none;
|
|
11
|
-
text-rendering: optimizeLegibility;
|
|
12
|
-
-webkit-font-smoothing: antialiased;
|
|
13
|
-
-moz-osx-font-smoothing: grayscale;
|
|
14
|
-
-webkit-text-size-adjust: 100%;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
a {
|
|
18
|
-
font-weight: 500;
|
|
19
|
-
color: #646cff;
|
|
20
|
-
text-decoration: inherit;
|
|
21
|
-
}
|
|
22
|
-
a:hover {
|
|
23
|
-
color: #535bf2;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
body {
|
|
27
|
-
margin: 0;
|
|
28
|
-
display: flex;
|
|
29
|
-
place-items: center;
|
|
30
|
-
min-width: 320px;
|
|
31
|
-
min-height: 100vh;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
h1 {
|
|
35
|
-
font-size: 3.2em;
|
|
36
|
-
line-height: 1.1;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
button {
|
|
40
|
-
border-radius: 8px;
|
|
41
|
-
border: 1px solid transparent;
|
|
42
|
-
padding: 0.6em 1.2em;
|
|
43
|
-
font-size: 1em;
|
|
44
|
-
font-weight: 500;
|
|
45
|
-
font-family: inherit;
|
|
46
|
-
background-color: #1a1a1a;
|
|
47
|
-
cursor: pointer;
|
|
48
|
-
transition: border-color 0.25s;
|
|
49
|
-
}
|
|
50
|
-
button:hover {
|
|
51
|
-
border-color: #646cff;
|
|
52
|
-
}
|
|
53
|
-
button:focus,
|
|
54
|
-
button:focus-visible {
|
|
55
|
-
outline: 4px auto -webkit-focus-ring-color;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.card {
|
|
59
|
-
padding: 2em;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
#app {
|
|
63
|
-
max-width: 1280px;
|
|
64
|
-
margin: 0 auto;
|
|
65
|
-
padding: 2rem;
|
|
66
|
-
text-align: center;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
@media (prefers-color-scheme: light) {
|
|
70
|
-
:root {
|
|
71
|
-
color: #213547;
|
|
72
|
-
background-color: #ffffff;
|
|
73
|
-
}
|
|
74
|
-
a:hover {
|
|
75
|
-
color: #747bff;
|
|
76
|
-
}
|
|
77
|
-
button {
|
|
78
|
-
background-color: #f9f9f9;
|
|
79
|
-
}
|
|
80
|
-
}
|
package/vite.config.ts
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
import { defineConfig } from 'vite'
|
|
2
2
|
import vue from '@vitejs/plugin-vue'
|
|
3
|
-
import
|
|
3
|
+
import AutoImport from 'unplugin-auto-import/vite' // element-plus自动引用使用
|
|
4
|
+
import Components from 'unplugin-vue-components/vite' // element-plus自动引用使用
|
|
5
|
+
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' // element-plus自动引用使用
|
|
4
6
|
|
|
5
7
|
// https://vitejs.dev/config/
|
|
6
8
|
export default defineConfig({
|
|
7
|
-
plugins: [
|
|
9
|
+
plugins: [
|
|
10
|
+
vue(),
|
|
11
|
+
AutoImport({
|
|
12
|
+
resolvers: [ElementPlusResolver()],
|
|
13
|
+
}),
|
|
14
|
+
Components({
|
|
15
|
+
resolvers: [ElementPlusResolver()],
|
|
16
|
+
}),
|
|
17
|
+
],
|
|
8
18
|
build: {
|
|
9
19
|
outDir: 'lib',
|
|
10
20
|
lib: {
|
|
11
|
-
entry:
|
|
21
|
+
entry: './packages/index.ts',
|
|
12
22
|
name: 'Bundle',
|
|
13
23
|
fileName: 'bundle'
|
|
14
|
-
}
|
|
24
|
+
}
|
|
15
25
|
}
|
|
16
26
|
})
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { ref } from 'vue'
|
|
3
|
-
|
|
4
|
-
defineProps<{ msg: string }>()
|
|
5
|
-
|
|
6
|
-
const count = ref(0)
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<template>
|
|
10
|
-
<h1>{{ msg }}</h1>
|
|
11
|
-
|
|
12
|
-
<div class="card">
|
|
13
|
-
<button type="button" @click="count++">count is {{ count }}</button>
|
|
14
|
-
<p>
|
|
15
|
-
Edit
|
|
16
|
-
<code>components/HelloWorld.vue</code> to test HMR
|
|
17
|
-
</p>
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
<p>
|
|
21
|
-
Check out
|
|
22
|
-
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
|
|
23
|
-
>create-vue</a
|
|
24
|
-
>, the official Vue + Vite starter
|
|
25
|
-
</p>
|
|
26
|
-
<p>
|
|
27
|
-
Install
|
|
28
|
-
<a href="https://github.com/vuejs/language-tools" target="_blank">Volar</a>
|
|
29
|
-
in your IDE for a better DX
|
|
30
|
-
</p>
|
|
31
|
-
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
|
|
32
|
-
</template>
|
|
33
|
-
|
|
34
|
-
<style scoped>
|
|
35
|
-
.read-the-docs {
|
|
36
|
-
color: #888;
|
|
37
|
-
}
|
|
38
|
-
</style>
|
|
File without changes
|