ref函数浅层解包
<template> <div> <h1>浅层解包</h1> {{ageobj.age.value}} --- {{ageobj.age}} <button @click="ageobj.age.value++ ">修改浅层解包的年龄</button> </div> </template> <script> import {ref} from 'vue' export default { setup(){ const age = ref(29) const ageobj = { age } return { ageobj } } } </script>
本文来自博客园,作者:杨建鑫,转载请注明原文链接:https://www.cnblogs.com/qd-lbxx/p/16618949.html