更新:登录功能
This commit is contained in:
10
uni_modules/wot-design-uni/components/wd-row/index.scss
Normal file
10
uni_modules/wot-design-uni/components/wd-row/index.scss
Normal file
@@ -0,0 +1,10 @@
|
||||
@import '../common/abstracts/variable';
|
||||
@import '../common/abstracts/mixin';
|
||||
|
||||
@include b(row) {
|
||||
&::after {
|
||||
display: table;
|
||||
clear: both;
|
||||
content: "";
|
||||
}
|
||||
}
|
||||
16
uni_modules/wot-design-uni/components/wd-row/types.ts
Normal file
16
uni_modules/wot-design-uni/components/wd-row/types.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { type InjectionKey } from 'vue'
|
||||
import { baseProps, makeNumberProp } from '../common/props'
|
||||
|
||||
export type RowProvide = {
|
||||
props: { gutter?: number }
|
||||
}
|
||||
|
||||
export const ROW_KEY: InjectionKey<RowProvide> = Symbol('wd-row')
|
||||
|
||||
export const rowProps = {
|
||||
...baseProps,
|
||||
/**
|
||||
* 列元素之间的间距(单位为px)
|
||||
*/
|
||||
gutter: makeNumberProp(0)
|
||||
}
|
||||
42
uni_modules/wot-design-uni/components/wd-row/wd-row.vue
Normal file
42
uni_modules/wot-design-uni/components/wd-row/wd-row.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<view :class="`wd-row ${customClass}`" :style="rowStyle">
|
||||
<!-- 每一行 -->
|
||||
<slot />
|
||||
</view>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'wd-row',
|
||||
options: {
|
||||
virtualHost: true,
|
||||
addGlobalClass: true,
|
||||
styleIsolation: 'shared'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script lang="ts" setup>
|
||||
import { computed, type CSSProperties } from 'vue'
|
||||
import { useChildren } from '../composables/useChildren'
|
||||
import { ROW_KEY, rowProps } from './types'
|
||||
import { addUnit, objToStyle } from '../common/util'
|
||||
|
||||
const props = defineProps(rowProps)
|
||||
const { linkChildren } = useChildren(ROW_KEY)
|
||||
|
||||
linkChildren({ props })
|
||||
|
||||
const rowStyle = computed(() => {
|
||||
const style: CSSProperties = {}
|
||||
const { gutter } = props
|
||||
if (gutter < 0) {
|
||||
console.error('[wot ui] warning(wd-row): attribute gutter must be greater than or equal to 0')
|
||||
} else if (gutter) {
|
||||
style.marginLeft = addUnit(gutter / 2)
|
||||
style.marginRight = addUnit(gutter / 2)
|
||||
}
|
||||
return `${objToStyle(style)}${props.customStyle}`
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import './index.scss';
|
||||
</style>
|
||||
Reference in New Issue
Block a user