Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/vue-cropper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1822,8 +1822,16 @@ export default {
}
// 截图框默认大小
// 如果为0 那么计算容器大小 默认为80%
var w = cw ? cw : parseFloat(this.autoCropWidth);
var h = ch ? ch : parseFloat(this.autoCropHeight);
var w = cw ? cw : (
/^(\d{1,2}|100)%$/.test(this.autoCropWidth)
? maxWidth * parseFloat(this.autoCropWidth) / 100
: parseFloat(this.autoCropWidth)
);
var h = ch ? ch : (
/^(\d{1,2}|100)%$/.test(this.autoCropHeight)
? maxHeight * parseFloat(this.autoCropHeight) / 100
: parseFloat(this.autoCropHeight)
);
if (w === 0 || h === 0) {
w = maxWidth * 0.8;
h = maxHeight * 0.8;
Expand Down