Skip to content

Commit

Permalink
fix(WaterMark): 修正 props 解构响应式丢失
Browse files Browse the repository at this point in the history
  • Loading branch information
WalkAlone0325 authored and sendya committed Mar 16, 2022
1 parent 430492d commit d9950fa
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions packages/pro-layout/src/components/WaterMark/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,7 @@ const WaterMark = defineComponent({
// antd 内容层 zIndex 基本上在 10 以下 https://github.com/ant-design/ant-design/blob/6192403b2ce517c017f9e58a32d58774921c10cd/components/style/themes/default.less#L335
zIndex = 9,
gapX = 212,
gapY = 222,
width = 120,
height = 64,
rotate = -22, // 默认旋转 -22 度
image,
content,
offsetLeft,
offsetTop,
fontStyle = 'normal',
fontWeight = 'normal',
fontColor = 'rgba(0,0,0,.15)',
fontSize = 16,
fontFamily = 'sans-serif',
prefixCls: customizePrefixCls,
} = props;

Expand All @@ -114,6 +102,23 @@ const WaterMark = defineComponent({
const base64Url = ref('');

watchEffect(() => {
const {
gapX = 212,
gapY = 222,
width = 120,
height = 64,
rotate = -22, // 默认旋转 -22 度
image,
content,
offsetLeft,
offsetTop,
fontStyle = 'normal',
fontWeight = 'normal',
fontColor = 'rgba(0,0,0,.15)',
fontSize = 16,
fontFamily = 'sans-serif',
} = props

const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const ratio = getPixelRatio(ctx);
Expand Down

0 comments on commit d9950fa

Please sign in to comment.