如果修改vue会提示(),只读,不可以修改
value cannot be made reactive: xxxx
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div id="app">
{{msg}}
</div>
</body>
<script src="https://unpkg.com/vue@next"></script>
<script>
const app=Vue.createApp({
setup(prop,context){
const {readonly}=Vue;
let msg=readonly('xxxx');
//修改变量的值
setTimeout(()=>{
msg.value='yyyyy'
},2000);
return{
msg
}
log:()=>{
alert("xxx");
}
}
});
app.mount("#app")
</script>
</html>