ref数据获取
<template> <div id="app"> <h2 v-text="appname" ref="title"></h2> <button ref = 'btn' @click="show">点我显示</button> </div> </template> <script> export default { name: 'app', data() { return{ appname:"666" } }, methods:{ show(){ console.log(this.$refs); } } } </script> <style> </style>
this.$refs打印出来:

this.$refs.title打印出来:


浙公网安备 33010602011771号