更新:登录功能
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
@import "./../../common/abstracts/_mixin.scss";
|
||||
@import "./../../common/abstracts/variable.scss";
|
||||
|
||||
.wot-theme-dark {
|
||||
@include b(key) {
|
||||
background: $-dark-background2;
|
||||
color: $-dark-color;
|
||||
|
||||
&:active {
|
||||
background-color: $-dark-background4;
|
||||
}
|
||||
|
||||
@include m(active) {
|
||||
background-color: $-dark-background4;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.wd-key-wrapper {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
flex-basis: 33%;
|
||||
box-sizing: border-box;
|
||||
padding: 0 6px 6px 0;
|
||||
|
||||
@include m(wider) {
|
||||
flex-basis: 66%;
|
||||
}
|
||||
}
|
||||
|
||||
@include b(key) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: $-number-keyboard-key-height;
|
||||
font-size: $-number-keyboard-key-font-size;
|
||||
line-height: 1.5;
|
||||
background: $-number-keyboard-key-background;
|
||||
border-radius: $-number-keyboard-key-border-radius;
|
||||
|
||||
&:active {
|
||||
background-color: $-number-keyboard-key-active-color;
|
||||
}
|
||||
|
||||
@include m(large) {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 6px;
|
||||
bottom: 6px;
|
||||
left: 0;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
@include m(delete, close) {
|
||||
font-size: $-number-keyboard-delete-font-size;
|
||||
}
|
||||
|
||||
@include m(active) {
|
||||
background-color: $-number-keyboard-key-active-color;
|
||||
}
|
||||
|
||||
@include m(close) {
|
||||
color: $-number-keyboard-button-text-color;
|
||||
background: $-number-keyboard-button-background;
|
||||
|
||||
&:active {
|
||||
background: $-number-keyboard-button-background;
|
||||
opacity: $-number-keyboard-button-active-opacity;
|
||||
}
|
||||
}
|
||||
|
||||
@include edeep(loading-icon) {
|
||||
color: $-number-keyboard-button-text-color;
|
||||
}
|
||||
|
||||
@include edeep(icon) {
|
||||
font-size: $-number-keyboard-icon-size;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<view :class="`wd-key-wrapper ${wider ? 'wd-key-wrapper--wider' : ''}`" @touchstart="onTouchStart" @touchmove="onTouchMove" @touchend="onTouchEnd">
|
||||
<view :class="keyClass">
|
||||
<wd-loading custom-class="wd-key__loading-icon" v-if="props.loading" />
|
||||
<template v-if="type === 'delete'">
|
||||
<template v-if="text">
|
||||
{{ text }}
|
||||
</template>
|
||||
<wd-icon v-else custom-class="wd-key__icon" name="keyboard-delete" size="22px"></wd-icon>
|
||||
</template>
|
||||
<template v-else-if="type === 'extra'">
|
||||
<template v-if="text">
|
||||
{{ text }}
|
||||
</template>
|
||||
<wd-icon v-else custom-class="wd-key__icon" name="keyboard-collapse" size="22px"></wd-icon>
|
||||
</template>
|
||||
<template v-else>{{ text }}</template>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'wd-key',
|
||||
options: {
|
||||
virtualHost: true,
|
||||
addGlobalClass: true,
|
||||
styleIsolation: 'shared'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import wdLoading from '../../wd-loading/wd-loading.vue'
|
||||
import wdIcon from '../../wd-icon/wd-icon.vue'
|
||||
import { computed, ref } from 'vue'
|
||||
import { useTouch } from '../../composables/useTouch'
|
||||
import { keyProps } from './types'
|
||||
|
||||
const props = defineProps(keyProps)
|
||||
const emit = defineEmits(['press'])
|
||||
|
||||
const touch = useTouch()
|
||||
const active = ref<boolean>(false)
|
||||
|
||||
const keyClass = computed(() => {
|
||||
return `wd-key ${props.large ? 'wd-key--large' : ''} ${props.type === 'delete' ? 'wd-key--delete' : ''} ${
|
||||
props.type === 'close' ? 'wd-key--close' : ''
|
||||
}`
|
||||
})
|
||||
|
||||
function onTouchStart(event: TouchEvent) {
|
||||
touch.touchStart(event)
|
||||
active.value = true
|
||||
}
|
||||
|
||||
function onTouchMove(event: TouchEvent) {
|
||||
touch.touchMove(event)
|
||||
if (touch.direction.value) {
|
||||
active.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onTouchEnd() {
|
||||
if (active.value) {
|
||||
active.value = false
|
||||
emit('press', props.text, props.type)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import './index.scss';
|
||||
</style>
|
||||
@@ -0,0 +1,11 @@
|
||||
import { makeBooleanProp, makeNumericProp, makeStringProp } from '../../common/props'
|
||||
|
||||
export type NumberKeyType = '' | 'delete' | 'extra' | 'close'
|
||||
|
||||
export const keyProps = {
|
||||
type: makeStringProp<NumberKeyType>(''),
|
||||
text: makeNumericProp(''),
|
||||
wider: makeBooleanProp(false),
|
||||
large: makeBooleanProp(false),
|
||||
loading: makeBooleanProp(false)
|
||||
}
|
||||
Reference in New Issue
Block a user