|
|
@@ -0,0 +1,120 @@
|
|
|
+{
|
|
|
+ "page": {
|
|
|
+ "prefix": "page",
|
|
|
+ "scope": "vue",
|
|
|
+ "body": [
|
|
|
+ "<template>",
|
|
|
+ " <cl-page>",
|
|
|
+ " <view class=\"p-3\">",
|
|
|
+ " $1",
|
|
|
+ " </view>",
|
|
|
+ " </cl-page>",
|
|
|
+ "</template>",
|
|
|
+ "",
|
|
|
+ "<script lang=\"ts\" setup>",
|
|
|
+ "import { service, 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 { service, 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 } 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 service.$1.page(params);",
|
|
|
+ "});",
|
|
|
+ "",
|
|
|
+ "async function onPull() {",
|
|
|
+ " await refresh({ page: 1 });",
|
|
|
+ " listViewRef.value!.stopRefresh();",
|
|
|
+ "}",
|
|
|
+ "",
|
|
|
+ "onReady(() => {",
|
|
|
+ " ui.showLoading(\"加载中\");",
|
|
|
+ " refresh({",
|
|
|
+ " page: 1,",
|
|
|
+ " size: 20,",
|
|
|
+ " });",
|
|
|
+ "});",
|
|
|
+ ""
|
|
|
+ ],
|
|
|
+ "description": "list-view refresh snippets"
|
|
|
+ }
|
|
|
+}
|