121 lines
2.6 KiB
Plaintext
121 lines
2.6 KiB
Plaintext
{
|
|
"page": {
|
|
"prefix": "page",
|
|
"scope": "vue",
|
|
"body": [
|
|
"<template>",
|
|
" <cl-page>",
|
|
" <view class=\"p-3\">",
|
|
" $1",
|
|
" </view>",
|
|
" </cl-page>",
|
|
"</template>",
|
|
"",
|
|
"<script lang=\"ts\" setup>",
|
|
"import { router } from \"@/cool\";",
|
|
"",
|
|
"</script>",
|
|
"",
|
|
"<style lang=\"scss\" scoped>",
|
|
"",
|
|
"</style>",
|
|
""
|
|
],
|
|
"description": "page snippets"
|
|
},
|
|
"popup": {
|
|
"prefix": "popup",
|
|
"scope": "vue",
|
|
"body": [
|
|
"<template>",
|
|
" <cl-popup v-model=\"visible\">",
|
|
" <view class=\"component$1\"> </view>",
|
|
" </cl-popup>",
|
|
"</template>",
|
|
"",
|
|
"<script lang=\"ts\" setup>",
|
|
"import { ref } from \"vue\";",
|
|
"import { router } from \"@/cool\";",
|
|
"",
|
|
"// 是否可见",
|
|
"const visible = ref(false);",
|
|
"",
|
|
"// 打开",
|
|
"function open() {",
|
|
" visible.value = true;",
|
|
"}",
|
|
"",
|
|
"// 关闭",
|
|
"function close() {",
|
|
" visible.value = false;",
|
|
"}",
|
|
"",
|
|
"defineExpose({",
|
|
" open,",
|
|
" close,",
|
|
"});",
|
|
"</script>",
|
|
"",
|
|
"<style lang=\"scss\" scoped>",
|
|
"",
|
|
"</style>",
|
|
""
|
|
],
|
|
"description": "popup snippets"
|
|
},
|
|
"pager": {
|
|
"prefix": "list-view-refresh",
|
|
"scope": "vue",
|
|
"body": [
|
|
"<template>",
|
|
" <cl-list-view",
|
|
" :data=\"listView\"",
|
|
" :virtual=\"false\"",
|
|
" :pt=\"{",
|
|
" refresher: {",
|
|
" className: 'pt-3'",
|
|
" }",
|
|
" }\"",
|
|
" :refresher-enabled=\"true\"",
|
|
" @pull=\"onPull\"",
|
|
" @bottom=\"loadMore\"",
|
|
" >",
|
|
" <template #item=\"{ value }\">",
|
|
" <view class=\"p-3\">",
|
|
" $1",
|
|
" </view>",
|
|
" </template>",
|
|
" </cl-list-view>",
|
|
"</template>",
|
|
"",
|
|
"<script lang=\"ts\" setup>",
|
|
"import { ref } from \"vue\";",
|
|
"import { usePager, request } from \"@/cool\";",
|
|
"import { useUi } from \"@/uni_modules/cool-ui\";",
|
|
"",
|
|
"const ui = useUi();",
|
|
"",
|
|
"const listViewRef = ref<ClListViewComponentPublicInstance | null>(null);",
|
|
"",
|
|
"const { refresh, listView, loading, loadMore } = usePager((params) => {",
|
|
" return request({ $1 });",
|
|
"});",
|
|
"",
|
|
"async function onPull() {",
|
|
" await refresh({ page: 1 });",
|
|
" listViewRef.value!.stopRefresh();",
|
|
"}",
|
|
"",
|
|
"onReady(() => {",
|
|
" ui.showLoading(\"加载中\");",
|
|
" refresh({",
|
|
" page: 1,",
|
|
" size: 20,",
|
|
" });",
|
|
"});",
|
|
""
|
|
],
|
|
"description": "list-view refresh snippets"
|
|
}
|
|
}
|