更新:登录功能
This commit is contained in:
100
uni_modules/wot-design-uni/components/wd-divider/index.scss
Normal file
100
uni_modules/wot-design-uni/components/wd-divider/index.scss
Normal file
@@ -0,0 +1,100 @@
|
||||
@import '../common/abstracts/variable';
|
||||
@import '../common/abstracts/mixin';
|
||||
|
||||
.wot-theme-dark {
|
||||
@include b(divider) {
|
||||
color: $-dark-color3;
|
||||
|
||||
@include e(line) {
|
||||
background: $-dark-color-gray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@include b(divider) {
|
||||
position: relative;
|
||||
display: flex;
|
||||
padding: $-divider-padding;
|
||||
margin: $-divider-margin;
|
||||
align-items: center;
|
||||
color: $-divider-color;
|
||||
font-size: $-divider-fs;
|
||||
|
||||
&::after,
|
||||
&::before {
|
||||
flex: 1;
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
border-style: solid;
|
||||
border-color: $-divider-line-color;
|
||||
border-width: $-divider-line-height 0 0;
|
||||
}
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
}
|
||||
|
||||
@include m(center, left, right) {
|
||||
&::after {
|
||||
content: '';
|
||||
margin-left: $-divider-content-left-margin;
|
||||
}
|
||||
|
||||
&::before {
|
||||
margin-right: $-divider-content-right-margin;
|
||||
}
|
||||
}
|
||||
|
||||
@include m(left) {
|
||||
&::before {
|
||||
max-width: $-divider-content-left-width;
|
||||
}
|
||||
}
|
||||
|
||||
@include m(right) {
|
||||
&::after {
|
||||
max-width: $-divider-content-right-width;
|
||||
}
|
||||
}
|
||||
|
||||
@include when(hairline) {
|
||||
|
||||
&::before,
|
||||
&::after {
|
||||
transform: scaleY(0.5);
|
||||
}
|
||||
}
|
||||
|
||||
@include when(dashed) {
|
||||
|
||||
&::before,
|
||||
&::after {
|
||||
border-style: dashed;
|
||||
}
|
||||
}
|
||||
|
||||
@include m(vertical) {
|
||||
display: inline-block;
|
||||
width: $-divider-vertical-line-width;
|
||||
height: $-divider-vertical-height;
|
||||
margin: $-divider-vertical-content-margin;
|
||||
padding: 0;
|
||||
vertical-align: middle;
|
||||
|
||||
&::before {
|
||||
height: 100%;
|
||||
border-width: 0 0 0 $-divider-vertical-line-width;
|
||||
}
|
||||
|
||||
&::after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@include when(hairline) {
|
||||
&::before {
|
||||
transform: scaleX(0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
35
uni_modules/wot-design-uni/components/wd-divider/types.ts
Normal file
35
uni_modules/wot-design-uni/components/wd-divider/types.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import type { ExtractPropTypes } from 'vue'
|
||||
import { baseProps, makeBooleanProp, makeStringProp } from '../common/props'
|
||||
|
||||
export type DividerPosition = 'center' | 'left' | 'right'
|
||||
export type DividerDirection = 'horizontal' | 'vertical'
|
||||
|
||||
export const dividerProps = {
|
||||
...baseProps,
|
||||
/**
|
||||
* 自定义颜色
|
||||
*/
|
||||
color: String,
|
||||
/**
|
||||
* 内容位置,可选值为 `left` `right` `center`
|
||||
* 默认值:`center`
|
||||
*/
|
||||
contentPosition: makeStringProp<DividerPosition>('center'),
|
||||
/**
|
||||
* 是否显示为虚线
|
||||
* 默认值:`false`
|
||||
*/
|
||||
dashed: Boolean,
|
||||
/**
|
||||
* 是否为垂直分割线
|
||||
* 默认值:`false`
|
||||
*/
|
||||
vertical: makeBooleanProp(false),
|
||||
/**
|
||||
* 是否显示为 0.5px 的线
|
||||
* 默认值:`true`
|
||||
*/
|
||||
hairline: makeBooleanProp(true)
|
||||
}
|
||||
|
||||
export type DividerProps = ExtractPropTypes<typeof dividerProps>
|
||||
@@ -0,0 +1,52 @@
|
||||
<template>
|
||||
<view :class="rootClass" :style="rootStyle">
|
||||
<slot v-if="!vertical"></slot>
|
||||
</view>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'wd-divider',
|
||||
options: {
|
||||
virtualHost: true,
|
||||
addGlobalClass: true,
|
||||
styleIsolation: 'shared'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, useSlots, type CSSProperties } from 'vue'
|
||||
import { dividerProps } from './types'
|
||||
import { objToStyle } from '../common/util'
|
||||
|
||||
const props = defineProps(dividerProps)
|
||||
const slots = useSlots()
|
||||
|
||||
const rootStyle = computed(() => {
|
||||
const { color, customStyle } = props
|
||||
const style: CSSProperties = {}
|
||||
if (color) {
|
||||
style.color = color
|
||||
}
|
||||
return `${objToStyle(style)}${customStyle}`
|
||||
})
|
||||
|
||||
const rootClass = computed(() => {
|
||||
const prefixCls = 'wd-divider'
|
||||
const classes: Record<string, boolean> = {
|
||||
[prefixCls]: true,
|
||||
['is-dashed']: props.dashed,
|
||||
['is-hairline']: props.hairline,
|
||||
[`${prefixCls}--vertical`]: props.vertical,
|
||||
[`${prefixCls}--center`]: !props.vertical && props.contentPosition === 'center' && !!slots.default,
|
||||
[`${prefixCls}--left`]: !props.vertical && props.contentPosition === 'left',
|
||||
[`${prefixCls}--right`]: !props.vertical && props.contentPosition === 'right',
|
||||
[props.customClass]: !!props.customClass
|
||||
}
|
||||
return classes
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './index.scss';
|
||||
</style>
|
||||
Reference in New Issue
Block a user