From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期三, 28 五月 2025 16:48:52 +0800 Subject: [PATCH] 初始化项目 --- uview-ui/components/u-td/u-td.vue | 66 +++++++++++++++++++++++++++++++++ 1 files changed, 66 insertions(+), 0 deletions(-) diff --git a/uview-ui/components/u-td/u-td.vue b/uview-ui/components/u-td/u-td.vue new file mode 100644 index 0000000..b00ad8b --- /dev/null +++ b/uview-ui/components/u-td/u-td.vue @@ -0,0 +1,66 @@ +<template> + <view class="u-td" :style="[tdStyle]"> + <slot></slot> + </view> +</template> + +<script> + /** + * td td鍗曞厓鏍� + * @description 琛ㄦ牸缁勪欢涓�鑸敤浜庡睍绀哄ぇ閲忕粨鏋勫寲鏁版嵁鐨勫満鏅紙鎼厤u-table浣跨敤锛� + * @tutorial https://www.uviewui.com/components/table.html#td-props + * @property {String Number} width 鍗曞厓鏍煎搴︾櫨鍒嗘瘮鎴栬�呭叿浣撳甫鍗曚綅鐨勫�硷紝濡�30%锛� 200rpx绛夛紝涓�鑸娇鐢ㄧ櫨鍒嗘瘮锛屽崟鍏冩牸瀹藉害榛樿涓哄潎鍒唗r鐨勯暱搴︼紙榛樿auto锛� + * @example <u-td>浜屽勾绾�</u-td> + */ + export default { + name: "u-td", + props: { + // 瀹藉害锛岀櫨鍒嗘瘮鎴栬�呭叿浣撳甫鍗曚綅鐨勫�硷紝濡�30%锛� 200rpx绛夛紝涓�鑸娇鐢ㄧ櫨鍒嗘瘮 + width: { + type: [Number, String], + default: 'auto' + } + }, + data() { + return { + tdStyle: { + + } + } + }, + created() { + this.parent = false; + }, + mounted() { + this.parent = this.$u.$parent.call(this, 'u-table'); + if (this.parent) { + // 灏嗙埗缁勪欢鐨勭浉鍏冲弬鏁帮紝鍚堝苟鍒版湰缁勪欢 + let style = {}; + if (this.width != "auto") style.flex = `0 0 ${this.width}`; + style.textAlign = this.parent.align; + style.fontSize = this.parent.fontSize + 'rpx'; + style.padding = this.parent.padding; + style.borderBottom = `solid 1px ${this.parent.borderColor}`; + style.borderRight = `solid 1px ${this.parent.borderColor}`; + style.color = this.parent.color; + this.tdStyle = style; + } + } + }; +</script> + +<style lang="scss" scoped> + @import "../../libs/css/style.components.scss"; + + .u-td { + @include vue-flex; + flex-direction: column; + flex: 1; + justify-content: center; + font-size: 28rpx; + color: $u-content-color; + align-self: stretch; + box-sizing: border-box; + height: 100%; + } +</style> -- Gitblit v1.9.3