You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
736 B
40 lines
736 B
<template> |
|
<h1>个人信息:</h1> |
|
<h2>姓名:{{ name }}</h2> |
|
<h2>年龄:{{ age }}</h2> |
|
<h2>工作种类:{{ job.type }}</h2> |
|
<h2>薪水:{{ job.salary }}</h2> |
|
<button @click="changeInfo">修改信息</button> |
|
</template> |
|
|
|
<script> |
|
import {ref} from "vue"; |
|
|
|
export default { |
|
name: 'App', |
|
setup() { |
|
// 数据 |
|
let name = ref('张三') |
|
let age = ref(19) |
|
let job = ref({ |
|
type: '前端工程师', |
|
salary: '30K' |
|
}) |
|
|
|
function changeInfo() { |
|
name.value = '李四' |
|
age.value = 88 |
|
job.value.type = '后端工程师' |
|
job.value.salary = '31K' |
|
console.log(name,age) |
|
} |
|
|
|
return { |
|
name, |
|
age, |
|
job, |
|
changeInfo, |
|
} |
|
} |
|
} |
|
</script>
|
|
|