wangzhibo
4 天以前 10595d8632f959d0954d1939243196f4eed02372
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
{
    "page": {
        "prefix": "page",
        "scope": "vue",
        "body": [
            "<template>",
            "    <cl-page>",
            "        <view class=\"page\">",
            "            $1",
            "        </view>",
            "    </cl-page>",
            "</template>",
            "",
            "<script lang=\"ts\" setup>",
            "import { useCool } from \"/@/cool\";",
            "",
            "const { service, router } = useCool();",
            "</script>",
            "",
            "<style lang=\"scss\" scoped>",
            ".page {",
            "    ",
            "}",
            "</style>",
            "",
        ],
        "description": "page snippets",
    },
    "component": {
        "prefix": "component",
        "scope": "vue",
        "body": [
            "<template>",
            "    <view class=\"$1\">",
            "        ",
            "    </view>",
            "</template>",
            "",
            "<script lang=\"ts\" setup>",
            "import { useCool } from \"/@/cool\";",
            "",
            "const { service, router } = useCool();",
            "</script>",
            "",
            "<style lang=\"scss\" scoped>",
            ".component$2 {",
            "    ",
            "}",
            "</style>",
            "",
        ],
        "description": "component snippets",
    },
    "popup": {
        "prefix": "popup",
        "scope": "vue",
        "body": [
            "<template>",
            "    <cl-popup v-model=\"visible\" direction=\"bottom\">",
            "        <view class=\"component$1\"> </view>",
            "    </cl-popup>",
            "</template>",
            "",
            "<script lang=\"ts\" setup>",
            "import { ref } from \"vue\";",
            "import { useCool } from \"/@/cool\";",
            "",
            "const { service, router } = useCool();",
            "",
            "// 是否可见",
            "const visible = ref(false);",
            "",
            "// 打开",
            "function open() {",
            "    visible.value = true;",
            "}",
            "",
            "// 关闭",
            "function close() {",
            "    visible.value = false;",
            "}",
            "",
            "defineExpose({",
            "    open,",
            "    close,",
            "});",
            "</script>",
            "",
            "<style lang=\"scss\" scoped>",
            ".component {",
            "}",
            "</style>",
            "",
        ],
        "description": "popup snippets",
    },
    "pager": {
        "prefix": "pager",
        "scope": "typescript",
        "body": [
            "const { service } = useCool();",
            "const { onRefresh, list } = usePager();",
            "",
            "function refresh(params?: any) {",
            "    const { data, next } = onRefresh(params);",
            "    next(service.$1.page(data));",
            "}",
            "",
            "onReady(() => {",
            "    refresh();",
            "});",
            "",
            "defineExpose({",
            "    refresh,",
            "});",
        ],
        "description": "pager snippets",
    },
}