first commit
This commit is contained in:
13
uni_modules/tdesign-uniapp/components/row/computed.js
Normal file
13
uni_modules/tdesign-uniapp/components/row/computed.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import utils from '../common/utils.wxs';
|
||||
|
||||
export function getRowStyles(gutter, customStyle) {
|
||||
let _style = '';
|
||||
if (gutter) {
|
||||
_style = utils._style({
|
||||
'margin-right': utils.addUnit(-gutter / 2),
|
||||
'margin-left': utils.addUnit(-gutter / 2),
|
||||
});
|
||||
}
|
||||
|
||||
return utils._style([customStyle]) + _style;
|
||||
}
|
||||
12
uni_modules/tdesign-uniapp/components/row/props.ts
Normal file
12
uni_modules/tdesign-uniapp/components/row/props.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
/* eslint-disable */
|
||||
|
||||
/**
|
||||
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
|
||||
* */
|
||||
|
||||
export default {
|
||||
/** 列之间的间距(默认单位px) */
|
||||
gutter: {
|
||||
type: [String, Number],
|
||||
},
|
||||
};
|
||||
6
uni_modules/tdesign-uniapp/components/row/row.css
Normal file
6
uni_modules/tdesign-uniapp/components/row/row.css
Normal file
@@ -0,0 +1,6 @@
|
||||
.t-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
63
uni_modules/tdesign-uniapp/components/row/row.vue
Normal file
63
uni_modules/tdesign-uniapp/components/row/row.vue
Normal file
@@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<view
|
||||
:class="prefix + '-row'"
|
||||
:style="getRowStyles(gutter, customStyle)"
|
||||
>
|
||||
<slot />
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { uniComponent } from '../common/src/index';
|
||||
import { prefix } from '../common/config';
|
||||
import props from './props';
|
||||
import tools from '../common/utils.wxs';
|
||||
import { getRowStyles } from './computed.js';
|
||||
import { ParentMixin, RELATION_MAP } from '../common/relation';
|
||||
|
||||
const name = `${prefix}-row`;
|
||||
|
||||
|
||||
export default uniComponent({
|
||||
name,
|
||||
options: {
|
||||
styleIsolation: 'shared',
|
||||
},
|
||||
mixins: [ParentMixin(RELATION_MAP.Col)],
|
||||
props: {
|
||||
...props,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
prefix,
|
||||
tools,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
gutter: {
|
||||
handler() {
|
||||
this.setGutter();
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
getRowStyles,
|
||||
innerAfterLinked() {
|
||||
this.setGutter();
|
||||
},
|
||||
setGutter() {
|
||||
const {
|
||||
gutter,
|
||||
} = this;
|
||||
|
||||
this.children?.forEach((o) => {
|
||||
o.gutter = gutter;
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
@import './row.css';
|
||||
</style>
|
||||
12
uni_modules/tdesign-uniapp/components/row/type.ts
Normal file
12
uni_modules/tdesign-uniapp/components/row/type.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
/* eslint-disable */
|
||||
|
||||
/**
|
||||
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
|
||||
* */
|
||||
|
||||
export interface TdRowProps {
|
||||
/**
|
||||
* 列之间的间距(默认单位px)
|
||||
*/
|
||||
gutter?: string | number;
|
||||
}
|
||||
Reference in New Issue
Block a user