JavaScript/vue.js/DOM元素修改:修订间差异
来自康健生活
创建页面,内容为“== 原生 == <syntaxhighlight lang="javascript"> document.getElementById("id");</syntaxhighlight> == vue == <syntaxhighlight lang="html5"> <div ref=“name”></div>…” |
|||
| 第6行: | 第6行: | ||
<div ref=“name”></div> | <div ref=“name”></div> | ||
<script> | <script> | ||
this.$refs.name | mounted() { | ||
this.$refs.name.style.backgroundColor="#108ee9" | |||
}, | |||
methods:{ | |||
this.$refs.name | |||
} | |||
</script> | </script> | ||
</syntaxhighlight> | </syntaxhighlight> | ||