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

feat: getElementById 支持泛型

上级 8e6663ea
...@@ -41,11 +41,13 @@ export default { ...@@ -41,11 +41,13 @@ export default {
text.style.setProperty('color', 'red') text.style.setProperty('color', 'red')
}, },
changeViewStyle(){ changeViewStyle(){
const view = uni.getElementById('view')! const view = uni.getElementById<UniViewElement>('view')
if(view !== null){
view.style.setProperty('width', '90%') view.style.setProperty('width', '90%')
view.style.setProperty('height', '50px') view.style.setProperty('height', '50px')
view.style.setProperty('backgroundColor', '#007AFF') view.style.setProperty('backgroundColor', '#007AFF')
} }
} }
}
} }
</script> </script>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册