reactive函数
作者:互联网
<template> <div> <h1>vue3</h1> <span>{{info.name}} - {{info.age}}</span> <button @click="infobtn">修改info</button> </div> </template> <script> import {reactive} from 'vue' export default { setup(){ // 数据 : reactive只能是复杂类型 const info = reactive({ name:'吴宇腾', age:18 }) // 事件 const infobtn = ()=>{ info.name = '海贼王', info.age = 1999 } return { info, infobtn } } } </script>
标签:info,const,函数,age,reactive,infobtn,name 来源: https://www.cnblogs.com/qd-lbxx/p/16618806.html