更新:登录功能
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
@import '../common/abstracts/variable';
|
||||
@import '../common/abstracts/mixin';
|
||||
|
||||
.wot-theme-dark {
|
||||
background-color: $-dark-background2;
|
||||
@include b(status-tip) {
|
||||
@include e(text) {
|
||||
color: $-dark-color3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@include b(status-tip) {
|
||||
padding: $-statustip-padding;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
color: $-statustip-color;
|
||||
font-size: $-statustip-fs;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
@include edeep(image) {
|
||||
margin: 0 auto;
|
||||
width: 160px;
|
||||
height: 160px;
|
||||
}
|
||||
@include e(text) {
|
||||
margin: 20px auto 0;
|
||||
font-size: $-statustip-fs;
|
||||
line-height: $-statustip-line-height;
|
||||
color: $-statustip-color;
|
||||
text-align: center;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
}
|
||||
65
uni_modules/wot-design-uni/components/wd-status-tip/types.ts
Normal file
65
uni_modules/wot-design-uni/components/wd-status-tip/types.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* @Author: weisheng
|
||||
* @Date: 2024-03-15 13:49:00
|
||||
* @LastEditTime: 2024-09-19 14:45:29
|
||||
* @LastEditors: weisheng
|
||||
* @Description:
|
||||
* @FilePath: \wot-design-uni\src\uni_modules\wot-design-uni\components\wd-status-tip\types.ts
|
||||
* 记得注释
|
||||
*/
|
||||
import type { ExtractPropTypes, PropType } from 'vue'
|
||||
import { baseProps, makeStringProp } from '../common/props'
|
||||
import type { ImageMode } from '../wd-img/types'
|
||||
|
||||
export type ImageSize = {
|
||||
/**
|
||||
* 宽度
|
||||
*/
|
||||
width: number | string
|
||||
/**
|
||||
* 高度
|
||||
*/
|
||||
height: number | string
|
||||
}
|
||||
|
||||
export const statusTipProps = {
|
||||
...baseProps,
|
||||
|
||||
/**
|
||||
* 缺省图片类型,支持传入图片 URL。
|
||||
* 类型: string
|
||||
* 可选值: search, network, content, collect, comment, halo, message
|
||||
* 默认值: network
|
||||
*/
|
||||
image: makeStringProp('network'),
|
||||
|
||||
/**
|
||||
* 图片大小,默认单位为 `px`。
|
||||
* 类型: string 或 number 或 ImageSize
|
||||
* 默认值: 空字符串
|
||||
*/
|
||||
imageSize: {
|
||||
type: [String, Number, Object] as PropType<string | number | ImageSize>,
|
||||
default: ''
|
||||
},
|
||||
/**
|
||||
* 提示文案。
|
||||
* 类型: string
|
||||
* 默认值: 空字符串
|
||||
*/
|
||||
tip: makeStringProp(''),
|
||||
/**
|
||||
* 图片裁剪、缩放的模式
|
||||
* 类型:string
|
||||
* 默认值:'aspectFill'
|
||||
*/
|
||||
imageMode: makeStringProp<ImageMode>('aspectFill'),
|
||||
/**
|
||||
* 图片路径前缀,指向图片所在目录,用于拼接图片 URL。推荐将图片放到自己的服务器上,并设置此属性。
|
||||
* 类型: string
|
||||
* 默认值: https://registry.npmmirror.com/wot-design-uni-assets/*\/files/
|
||||
*/
|
||||
urlPrefix: makeStringProp('https://registry.npmmirror.com/wot-design-uni-assets/*/files/')
|
||||
}
|
||||
|
||||
export type StatusTipProps = ExtractPropTypes<typeof statusTipProps>
|
||||
@@ -0,0 +1,70 @@
|
||||
<!--
|
||||
* @Author: weisheng
|
||||
* @Date: 2023-06-12 10:04:19
|
||||
* @LastEditTime: 2024-09-20 10:23:38
|
||||
* @LastEditors: jiaoxueyan
|
||||
* @Description:
|
||||
* @FilePath: \wot-design-uni\src\uni_modules\wot-design-uni\components\wd-status-tip\wd-status-tip.vue
|
||||
* 记得注释
|
||||
-->
|
||||
<template>
|
||||
<view :class="`wd-status-tip ${customClass}`" :style="customStyle">
|
||||
<slot name="image" v-if="$slots.image"></slot>
|
||||
<wd-img v-else-if="imgUrl" :mode="imageMode" :src="imgUrl" custom-class="wd-status-tip__image" :custom-style="imgStyle"></wd-img>
|
||||
<view v-if="tip" class="wd-status-tip__text">{{ tip }}</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'wd-status-tip',
|
||||
options: {
|
||||
addGlobalClass: true,
|
||||
virtualHost: true,
|
||||
styleIsolation: 'shared'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import wdImg from '../wd-img/wd-img.vue'
|
||||
import { computed, type CSSProperties } from 'vue'
|
||||
import { addUnit, isDef, isObj, objToStyle } from '../common/util'
|
||||
import { statusTipProps } from './types'
|
||||
|
||||
const props = defineProps(statusTipProps)
|
||||
|
||||
// 图片地址
|
||||
const imgUrl = computed(() => {
|
||||
// 改用网络地址,避免小程序打包的时候统一打包进去导致包过大问题
|
||||
let img: string = ''
|
||||
if (['search', 'network', 'content', 'collect', 'comment', 'halo', 'message'].includes(props.image)) {
|
||||
img = `${props.urlPrefix}${props.image}.png`
|
||||
} else {
|
||||
img = props.image
|
||||
}
|
||||
return img
|
||||
})
|
||||
|
||||
/**
|
||||
* 图片样式
|
||||
*/
|
||||
const imgStyle = computed(() => {
|
||||
let style: CSSProperties = {}
|
||||
if (props.imageSize) {
|
||||
if (isObj(props.imageSize)) {
|
||||
isDef(props.imageSize.height) && (style.height = addUnit(props.imageSize.height))
|
||||
isDef(props.imageSize.width) && (style.width = addUnit(props.imageSize.width))
|
||||
} else {
|
||||
style = {
|
||||
height: addUnit(props.imageSize),
|
||||
width: addUnit(props.imageSize)
|
||||
}
|
||||
}
|
||||
}
|
||||
return `${objToStyle(style)}`
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import './index.scss';
|
||||
</style>
|
||||
Reference in New Issue
Block a user