Skip to content

Commit

Permalink
fix: 修复button组件click事件传出event及image组件尺寸优化
Browse files Browse the repository at this point in the history
  • Loading branch information
jry committed Nov 19, 2024
1 parent d9c4a14 commit 62a33ad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/pages/example/components.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
</template>

<script lang="ts">
import list from "./components.config.js"; import { os, toast } from '@/uni_modules/uview-plus';
import list from "./components.config.js";
import { os, toast } from '@/uni_modules/uview-plus';
export default {
data() {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export default {
if (!this.disabled && !this.loading) {
// 进行节流控制,每this.throttle毫秒内,只在开始处执行
throttle(() => {
this.$emit("click");
this.$emit("click", e);
}, this.throttleTime);
}
// 是否阻止事件传播
Expand Down
18 changes: 6 additions & 12 deletions src/uni_modules/uview-plus/components/u-image/u-image.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
:lazy-load="lazyLoad"
class="u-image__image"
:style="{
borderRadius: shape == 'circle' ? '10000px' : addUnit(radius),
width: addUnit(width),
height: addUnit(height)
borderRadius: shape == 'circle' ? '10000px' : addUnit(radius)
}"
></image>
<view
Expand All @@ -38,25 +36,19 @@
<slot name="loading">
<u-icon
:name="loadingIcon"
:width="width"
:height="height"
></u-icon>
</slot>
</view>
<view
v-if="showError && isError && !loading"
class="u-image__error"
:style="{
borderRadius: shape == 'circle' ? '50%' : addUnit(radius),
width: addUnit(width),
height: addUnit(height)
borderRadius: shape == 'circle' ? '50%' : addUnit(radius)
}"
>
<slot name="error">
<u-icon
:name="errorIcon"
:width="width"
:height="height"
></u-icon>
</slot>
</view>
Expand Down Expand Up @@ -140,8 +132,10 @@
wrapStyle() {
let style = {};
// 通过调用addUnit()方法,如果有单位,如百分比,px单位等,直接返回,如果是纯粹的数值,则加上rpx单位
style.width = addUnit(this.width);
style.height = addUnit(this.height);
// style.width = addUnit(this.width);
// style.height = addUnit(this.height);
style.width = '100%';
style.height = '100%';
// 如果是显示圆形,设置一个很多的半径值即可
style.borderRadius = this.shape == 'circle' ? '10000px' : addUnit(this.radius)
// 如果设置圆角,必须要有hidden,否则可能圆角无效
Expand Down

0 comments on commit 62a33ad

Please sign in to comment.