b2nil / taro-ui-vue3

采用 Vue 3.0 重写的 Taro UI 组件库
https://b2nil.github.io/taro-ui-vue3/
MIT License
160 stars 51 forks source link

对齐子元素margin的偏移 #85

Closed unforesndprson closed 3 years ago

unforesndprson commented 3 years ago

fix(ImagePicker):修复图片上传选择器内容不居中

b2nil commented 3 years ago

感谢 PR。 虽然 commit 里面可以看到, 但是,可以稍微增加一些适当的描述吗? 比如,这个 PR 是针对对哪个组件的,解决了什么问题等。

这样方便检索查询。

b2nil commented 3 years ago

@unforesndprson 虽然将 &__flex-box 整体向左偏移 $spacing-h-sm 也实现了居中效果,但我个人偏向于以下方式:

&__flex-item {
    ...
    &:nth-child(1) {
        margin-left: 0;
    }
}

两种方法实现的效果是一样的,具体选用哪一种,可否由 Zoney 你来决定? 如果决定采用 &__flex-box 整体向左偏移的方式,那么我就直接合并了。

unforesndprson commented 3 years ago

@unforesndprson 虽然将 &__flex-box 整体向左偏移 $spacing-h-sm 也实现了居中效果,但我个人偏向于以下方式:

&__flex-item {
    ...
    &:nth-child(1) {
        margin-left: 0;
    }
}

两种方法实现的效果是一样的,具体选用哪一种,可否由 Zoney 你来决定? 如果决定采用 &__flex-box 整体向左偏移的方式,那么我就直接合并了。

考虑到如果需要调整flex-item间距时之前的方法需要改两处,所以首个flex-item 的margin-left置为0的方案会更适合,当然需要加个!important,避免被覆盖