diff --git a/package.json b/package.json index ba70318..1331f11 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "@princess-ui/components": "workspace:*", "@princess-ui/docs": "workspace:*", "@princess-ui/playground": "workspace:*", + "@princess-ui/hooks": "workspace:*", "@princess-ui/share": "workspace:*", "@princess-ui/theme-chalk": "workspace:*", "@types/gulp": "^4.0.9", diff --git a/packages/components/button/aaa.css b/packages/components/button/aaa.css deleted file mode 100644 index cc9a3d0..0000000 --- a/packages/components/button/aaa.css +++ /dev/null @@ -1,3 +0,0 @@ -div{ - background-color: rebeccapurple; -} \ No newline at end of file diff --git a/packages/components/button/index.vue b/packages/components/button/index.vue index 8f3d5fb..06bf8a2 100644 --- a/packages/components/button/index.vue +++ b/packages/components/button/index.vue @@ -1,6 +1,6 @@ @@ -9,22 +9,7 @@ import { defineComponent, PropType } from "vue" export default defineComponent({ props: { - color: { - type: String as PropType<'blue' | 'red'>, - required: true - }, - aaa: { - type: String as PropType<'dd' | 'red'>, - required: true - }, + text: String, }, }) - - - \ No newline at end of file + \ No newline at end of file diff --git a/packages/components/send/index.vue b/packages/components/send/index.vue index c0db920..1011153 100644 --- a/packages/components/send/index.vue +++ b/packages/components/send/index.vue @@ -1,15 +1,82 @@ - +const text = ref(props.initText) +const isDisabled = ref(false) +const isLoading = ref(false) +let number = props.duration +let timeID: any + +onBeforeUnmount(() => { + stop() +}) - \ No newline at end of file + +function onClick() { + emits( + "send", + () => { + isDisabled.value = true + isLoading.value = true + text.value = props.loadingText + }, + (isDone: boolean) => { + if (isDone) { + run() + } else { + stop() + } + }, + ) +} + diff --git a/packages/hooks/package.json b/packages/hooks/package.json new file mode 100644 index 0000000..9126578 --- /dev/null +++ b/packages/hooks/package.json @@ -0,0 +1,11 @@ +{ + "name": "@princess-ui/hooks", + "version": "1.0.0", + "description": "", + "main": "index.ts", + "module": "index.ts", + "scripts": {}, + "keywords": [], + "author": "", + "license": "ISC" +} diff --git a/packages/hooks/useNamespace.ts b/packages/hooks/useNamespace.ts new file mode 100644 index 0000000..55c8bf9 --- /dev/null +++ b/packages/hooks/useNamespace.ts @@ -0,0 +1,5 @@ +export function useNamespace(text: string) { + return { + + } +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 205fa5a..98cc37f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,6 +6,7 @@ "noImplicitAny": false, "declaration": true, "sourceMap": true, + "jsx": "preserve", "moduleResolution": "Node", "lib": ["ES2018", "DOM", "DOM.Iterable"], "allowSyntheticDefaultImports": true