Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(circle): fix type not work (#3228)
fix #3168
- Loading branch information
Showing
7 changed files
with
111 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
type CanvasContext = WechatMiniprogram.CanvasContext; | ||
|
||
export function adaptor( | ||
ctx: CanvasRenderingContext2D | ||
): CanvasContext & CanvasRenderingContext2D { | ||
// @ts-ignore | ||
return Object.assign(ctx, { | ||
setStrokeStyle(val) { | ||
ctx.strokeStyle = val; | ||
}, | ||
setLineWidth(val) { | ||
ctx.lineWidth = val; | ||
}, | ||
setLineCap(val) { | ||
ctx.lineCap = val; | ||
}, | ||
setFillStyle(val) { | ||
ctx.fillStyle = val; | ||
}, | ||
setFontSize(val) { | ||
ctx.font = String(val); | ||
}, | ||
setGlobalAlpha(val) { | ||
ctx.globalAlpha = val; | ||
}, | ||
setLineJoin(val) { | ||
ctx.lineJoin = val; | ||
}, | ||
setTextAlign(val) { | ||
ctx.textAlign = val; | ||
}, | ||
setMiterLimit(val) { | ||
ctx.miterLimit = val; | ||
}, | ||
setShadow(offsetX, offsetY, blur, color) { | ||
ctx.shadowOffsetX = offsetX; | ||
ctx.shadowOffsetY = offsetY; | ||
ctx.shadowBlur = blur; | ||
ctx.shadowColor = color; | ||
}, | ||
setTextBaseline(val) { | ||
ctx.textBaseline = val; | ||
}, | ||
createCircularGradient() {}, | ||
draw() {}, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
<wxs src="../wxs/utils.wxs" module="utils" /> | ||
|
||
<view class="van-circle"> | ||
<canvas class="van-circle__canvas" style="width: {{ utils.addUnit(size) }};height:{{ utils.addUnit(size) }}" canvas-id="van-circle"></canvas> | ||
<canvas class="van-circle__canvas" type="{{ type }}" style="width: {{ utils.addUnit(size) }};height:{{ utils.addUnit(size) }}" id="van-circle" canvas-id="van-circle"></canvas> | ||
<view wx:if="{{ !text }}" class="van-circle__text"> | ||
<slot></slot> | ||
</view> | ||
<cover-view wx:else class="van-circle__text">{{ text }}</cover-view> | ||
</view> | ||
</view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters