Browse Source

fixed bug

master
1549469775 3 years ago
parent
commit
50dfb5372b
  1. 2
      package.json
  2. 2
      packages/components/captcha/index.ts
  3. 12
      packages/components/captcha/index.vue
  4. 1
      packages/playground/components.d.ts
  5. 2
      packages/playground/package.json
  6. 13
      packages/playground/src/App.vue
  7. 14
      packages/theme-chalk/gulpfile.ts
  8. 1
      packages/theme-chalk/src/button.scss
  9. 17
      packages/theme-chalk/src/captcha.scss
  10. 1
      packages/theme-chalk/src/common/var.scss
  11. 5
      packages/theme-chalk/src/index.scss
  12. 1
      tsconfig.json

2
package.json

@ -17,7 +17,7 @@
"doc:dev": "pnpm run -C docs dev", "doc:dev": "pnpm run -C docs dev",
"doc:build": "pnpm run -C docs build", "doc:build": "pnpm run -C docs build",
"doc:serve": "pnpm run -C docs serve", "doc:serve": "pnpm run -C docs serve",
"build": "pnpm run -C packages/build build && pnpm run -C packages/princess-ui build", "build": "pnpm run -C packages/build build && pnpm run -C packages/theme-chalk build && pnpm run -C packages/princess-ui build",
"theme": "pnpm run -C packages/theme-chalk build", "theme": "pnpm run -C packages/theme-chalk build",
"release": "cd packages/princess-ui & npm publish" "release": "cd packages/princess-ui & npm publish"
}, },

2
packages/components/captcha/index.ts

@ -1,7 +1,5 @@
import PsCaptcha from "./index.vue" import PsCaptcha from "./index.vue"
PsCaptcha.name = "ps-captcha"
export { export {
PsCaptcha PsCaptcha
} }

12
packages/components/captcha/index.vue

@ -1,11 +1,18 @@
<template> <template>
<div class="ps-send" @click="onClick" :disabled="isDisabled" :loading="isLoading" type="button" size="small"> <div class="ps-send" :class="[size ? 'ps-send--' + size : '']" @click="onClick" :disabled="isDisabled"
:loading="isLoading" type="button" size="small">
{{ text }} {{ text }}
</div> </div>
</template> </template>
<script lang="ts">
export default defineComponent({
name: "ps-captcha"
})
</script>
<script lang="ts" setup> <script lang="ts" setup>
import { onBeforeUnmount, ref } from "vue" import { defineComponent, onBeforeUnmount, ref } from "vue"
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
duration?: number duration?: number
@ -13,6 +20,7 @@ const props = withDefaults(
runText?: string runText?: string
loadingText?: string loadingText?: string
resetText?: string resetText?: string
size?: "small" | "big"
}>(), }>(),
{ {
runText: "{%s}s 后重新发送", runText: "{%s}s 后重新发送",

1
packages/playground/components.d.ts

@ -6,6 +6,7 @@ import '@vue/runtime-core'
declare module '@vue/runtime-core' { declare module '@vue/runtime-core' {
export interface GlobalComponents { export interface GlobalComponents {
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default'] HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
PsCaptcha: typeof import('@princess-ui/components/captcha')['PsCaptcha']
} }
} }

2
packages/playground/package.json

@ -3,7 +3,7 @@
"private": true, "private": true,
"version": "0.0.0", "version": "0.0.0",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite --port=3433",
"build": "vue-tsc --noEmit && vite build", "build": "vue-tsc --noEmit && vite build",
"preview": "vite preview" "preview": "vite preview"
}, },

13
packages/playground/src/App.vue

@ -13,15 +13,22 @@ function send(start: () => void, done: (isDone: boolean) => void) {
<template> <template>
<ps-captcha @send="send" :duration="5">sada</ps-captcha> <ps-captcha @send="send" :duration="5">sada</ps-captcha>
<ps-captcha size="small" @send="send" :duration="5">sada</ps-captcha>
<ps-captcha size="big" @send="send" :duration="5">sada</ps-captcha>
</template> </template>
<style> <style>
html,body{
margin: 0;
padding: 0;
}
#app { #app {
font-family: Avenir, Helvetica, Arial, sans-serif; display: flex;
justify-content: center;
align-items: center;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
text-align: center; text-align: center;
color: #2c3e50; height: 100vh;
margin-top: 60px;
} }
</style> </style>

14
packages/theme-chalk/gulpfile.ts

@ -8,10 +8,16 @@ import cleanCSS from 'gulp-clean-css'
import rename from 'gulp-rename' import rename from 'gulp-rename'
import consola from 'consola' import consola from 'consola'
import { getOutput } from "@princess-ui/share"; import { getOutput } from "@princess-ui/share";
import rimraf from "rimraf"
const distFolder = path.resolve(__dirname, 'dist') const distFolder = path.resolve(__dirname, 'dist')
const distBundle = getOutput("theme-chalk") const distBundle = getOutput("theme-chalk")
function clean(cb) {
rimraf.sync(distBundle)
cb()
}
/** /**
* compile theme-chalk scss & minify * compile theme-chalk scss & minify
* not use sass.sync().on('error', sass.logError) to throw exception * not use sass.sync().on('error', sass.logError) to throw exception
@ -80,9 +86,9 @@ export function copyThemeChalkSource() {
) )
} }
export const build = parallel( export const build = series(clean, parallel(
copyThemeChalkSource, copyThemeChalkSource,
series(buildThemeChalk, buildDarkCssVars, copyThemeChalkBundle) series(buildThemeChalk, buildDarkCssVars, copyThemeChalkBundle)
) ))
export default build export default build

1
packages/theme-chalk/src/button.scss

@ -1,3 +1,4 @@
@use "common/var.scss";
div{ div{
color: darkkhaki; color: darkkhaki;

17
packages/theme-chalk/src/captcha.scss

@ -1,4 +1,19 @@
.ps-send{ @use 'common/var.scss';
.ps-send {
user-select: none;
color: blue; color: blue;
cursor: pointer; cursor: pointer;
display: inline-block;
padding: 4px 10px;
border-radius: 15px;
border: 1px solid blue;
&--small {
font-size: 14px;
padding: 2px 6px;
}
&--big {
font-size: 18px;
padding: 4px 10px;
}
} }

1
packages/theme-chalk/src/common/var.scss

@ -0,0 +1 @@

5
packages/theme-chalk/src/index.scss

@ -1,5 +1,2 @@
@import "./button.scss"; @import "./button.scss";
@import "./send.scss"; @import "./captcha.scss";
div{
color: rosybrown;
}

1
tsconfig.json

@ -13,6 +13,7 @@
}, },
"include": ["packages", "typings"], "include": ["packages", "typings"],
"exclude": [ "exclude": [
"packages/princess-ui/lib/**/*",
"node_modules", "node_modules",
"**/dist", "**/dist",
"**/__tests__/**/*", "**/__tests__/**/*",

Loading…
Cancel
Save