更新:登录功能
This commit is contained in:
19
uni_modules/wot-design-uni/components/wd-col/index.scss
Normal file
19
uni_modules/wot-design-uni/components/wd-col/index.scss
Normal file
@@ -0,0 +1,19 @@
|
||||
@import '../common/abstracts/variable';
|
||||
@import '../common/abstracts/mixin';
|
||||
|
||||
$i: 1;
|
||||
|
||||
@include b(col) {
|
||||
float: left;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@while $i <= 24 {
|
||||
.wd-col__#{$i} {
|
||||
width: calc(100% / 24 * $i);
|
||||
}
|
||||
.wd-col__offset-#{$i} {
|
||||
margin-left: calc(100% / 24 * $i);
|
||||
}
|
||||
$i: $i + 1;
|
||||
}
|
||||
15
uni_modules/wot-design-uni/components/wd-col/types.ts
Normal file
15
uni_modules/wot-design-uni/components/wd-col/types.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { ExtractPropTypes } from 'vue'
|
||||
import { baseProps, makeNumberProp } from '../common/props'
|
||||
|
||||
export const colProps = {
|
||||
...baseProps,
|
||||
/**
|
||||
* 列元素宽度
|
||||
*/
|
||||
span: makeNumberProp(24),
|
||||
/**
|
||||
* 列元素偏移距离
|
||||
*/
|
||||
offset: makeNumberProp(0)
|
||||
}
|
||||
export type ColProps = ExtractPropTypes<typeof colProps>
|
||||
49
uni_modules/wot-design-uni/components/wd-col/wd-col.vue
Normal file
49
uni_modules/wot-design-uni/components/wd-col/wd-col.vue
Normal file
@@ -0,0 +1,49 @@
|
||||
<template>
|
||||
<view :class="['wd-col', span && 'wd-col__' + span, offset && 'wd-col__offset-' + offset, customClass]" :style="rootStyle">
|
||||
<!-- 每一列 -->
|
||||
<slot />
|
||||
</view>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'wd-col',
|
||||
options: {
|
||||
addGlobalClass: true,
|
||||
virtualHost: true,
|
||||
styleIsolation: 'shared'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, watch } from 'vue'
|
||||
import { useParent } from '../composables/useParent'
|
||||
import { ROW_KEY } from '../wd-row/types'
|
||||
import { colProps } from './types'
|
||||
import { isDef } from '../common/util'
|
||||
|
||||
const props = defineProps(colProps)
|
||||
const { parent: row } = useParent(ROW_KEY)
|
||||
|
||||
const rootStyle = computed(() => {
|
||||
const gutter = isDef(row) ? row.props.gutter || 0 : 0
|
||||
const padding = `${gutter / 2}px`
|
||||
const style = gutter > 0 ? `padding-left: ${padding}; padding-right: ${padding};background-clip: content-box;` : ''
|
||||
return `${style}${props.customStyle}`
|
||||
})
|
||||
|
||||
watch([() => props.span, () => props.offset], () => {
|
||||
check()
|
||||
})
|
||||
|
||||
function check() {
|
||||
const { span, offset } = props
|
||||
if (span < 0 || offset < 0) {
|
||||
console.error('[wot-design] warning(wd-col): attribute span/offset must be greater than or equal to 0')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './index.scss';
|
||||
</style>
|
||||
Reference in New Issue
Block a user