提交 d9c73af6 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

refactor(element-draw): 优化 element 非空断言

上级 5588f7f1
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<!-- #endif --> <!-- #endif -->
</template> </template>
<script> <script lang="uts">
var y = 160 var y = 160
export default { export default {
data() { data() {
...@@ -57,9 +57,9 @@ ...@@ -57,9 +57,9 @@
}, },
methods: { methods: {
drawText() { drawText() {
let element = uni.getElementById('draw-text-view') let element = uni.getElementById('draw-text-view')!
let ctx = element!.getDrawableContext() let ctx = element.getDrawableContext()
let width = element!.getBoundingClientRect().width let width = element.getBoundingClientRect().width
ctx!.reset() ctx!.reset()
ctx!.font = "15px" ctx!.font = "15px"
ctx!.textAlign = "center" ctx!.textAlign = "center"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册