1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
| <template>
| <div class="goods-rank">
| <div class="goods-rank__header">
| <span>商品销售排行</span>
| </div>
|
| <div class="goods-rank__container">
| <div class="goods-rank__table">
| <cl-crud ref="Crud" padding="0">
| <cl-table ref="Table" :border="false" />
| </cl-crud>
| </div>
| </div>
| </div>
| </template>
|
| <script lang="ts" setup>
| import { useCrud, useTable } from "@cool-vue/crud";
| import { useCool } from "/@/cool";
|
| const { service } = useCool();
|
| const Crud = useCrud(
| {
| service: service.count.home,
| dict: {
| api: {
| page: "goodsRank"
| }
| }
| },
| (app) => {
| app.refresh({
| type: "amount",
| limit: 10
| });
| }
| );
|
| const Table = useTable({
| autoHeight: false,
| contextMenu: [],
| columns: [
| {
| label: "排名",
| type: "index",
| width: 60
| },
| {
| label: "商品标题",
| prop: "title",
| align: "left",
| showOverflowTooltip: true,
| minWidth: 200
| },
| {
| label: "商品图标",
| prop: "mainPic",
| width: 140,
| component: {
| name: "cl-image",
| props: {
| size: 40
| }
| }
| },
| {
| label: "销售金额",
| prop: "total",
| width: 140
| }
| ]
| });
| </script>
|
| <style lang="scss" scoped>
| .goods-rank {
| &__header {
| display: flex;
| align-items: center;
| height: 50px;
| font-size: 15px;
| font-weight: bold;
| padding: 0 20px;
| }
|
| &__table {
| padding: 0 10px 20px 10px;
| margin: 0 10px;
| background-color: var(--el-bg-color);
| }
| }
| </style>
|
|