<template>
<div >
<div ref="text">哈哈</div>
</div>
</template>
methods: {
onClick: function() {
this.$refs.text.style.color = "red"; //更新样式
this.$refs.text.innerText = "hahaha"; //更新值
console.log(this.$refs.text);
}
}
网友评论