From d1448cb0ef10f358bb7bddb4e1ec268515e0b787 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期二, 15 七月 2025 11:46:57 +0800 Subject: [PATCH] 项目初始化 --- uni_modules/uview-ui/components/u-steps/u-steps.vue | 80 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 80 insertions(+), 0 deletions(-) diff --git a/uni_modules/uview-ui/components/u-steps/u-steps.vue b/uni_modules/uview-ui/components/u-steps/u-steps.vue new file mode 100644 index 0000000..3ab7764 --- /dev/null +++ b/uni_modules/uview-ui/components/u-steps/u-steps.vue @@ -0,0 +1,80 @@ +<template> + <view + class="u-steps" + :class="[`u-steps--${direction}`]" + > + <slot></slot> + </view> +</template> + +<script> + import props from './props.js'; + /** + * Steps 姝ラ鏉� + * @description 璇ョ粍浠朵竴鑸敤浜庡畬鎴愪竴涓换鍔¤鍒嗗嚑涓楠わ紝鏍囪瘑鐩墠澶勪簬绗嚑姝ョ殑鍦烘櫙銆� + * @tutorial https://uviewui.com/components/steps.html + * @property {String} direction row-妯悜锛宑olumn-绔栧悜 (榛樿 'row' ) + * @property {String | Number} current 璁剧疆褰撳墠澶勪簬绗嚑姝� (榛樿 0 ) + * @property {String} activeColor 婵�娲荤姸鎬侀鑹� (榛樿 '#3c9cff' ) + * @property {String} inactiveColor 鏈縺娲荤姸鎬侀鑹� (榛樿 '#969799' ) + * @property {String} activeIcon 婵�娲荤姸鎬佺殑鍥炬爣 + * @property {String} inactiveIcon 鏈縺娲荤姸鎬佸浘鏍� + * @property {Boolean} dot 鏄惁鏄剧ず鐐圭被鍨� (榛樿 false ) + * @example <u-steps current="0"><u-steps-item title="宸插嚭搴�" desc="10:35" ></u-steps-item></u-steps> + */ + export default { + name: 'u-steps', + mixins: [uni.$u.mpMixin, uni.$u.mixin, props], + data() { + return { + } + }, + watch: { + children() { + this.updateChildData() + }, + parentData() { + this.updateChildData() + } + }, + computed: { + // 鐩戝惉鍙傛暟鐨勫彉鍖栵紝閫氳繃watch涓紝鎵嬪姩鍘绘洿鏂板瓙缁勪欢鐨勬暟鎹紝鍚﹀垯瀛愮粍浠朵笉浼氳嚜鍔ㄥ彉鍖� + parentData() { + return [this.current, this.direction, this.activeColor, this.inactiveColor, this.activeIcon, this.inactiveIcon, this.dot] + } + }, + methods: { + // 鏇存柊瀛愮粍浠剁殑鏁版嵁 + updateChildData() { + this.children.map(child => { + // 鍏堝垽鏂瓙缁勪欢鏄惁瀛樺湪瀵瑰簲鐨勬柟娉� + uni.$u.test.func((child || {}).updateFromParent()) && child.updateFromParent() + }) + }, + // 鎺ュ彈瀛愮粍浠剁殑閫氱煡锛屽幓淇敼鍏朵粬瀛愮粍浠剁殑鏁版嵁 + updateFromChild() { + this.updateChildData() + } + }, + created() { + this.children = [] + } + } +</script> + +<style lang="scss" scoped> + @import "../../libs/css/components.scss"; + + .u-steps { + @include flex; + + &--column { + flex-direction: column + } + + &--row { + flex-direction: row; + flex: 1; + } + } +</style> -- Gitblit v1.9.3