interface 接口
<template> <div> <p>{{ fullName }}</p> </div> </template> <script lang="ts" setup> import { ref } from 'vue'; interface Person { firstName: string; lastName: string; } function greeter(person: Person) { return 'Hello, ' + person.firstName + ' ' + person.lastName; } let user = { firstName: '张', lastName: '三丰' }; const fullName =ref(greeter(user)); </script> <style lang="scss" scoped></style>
标签:TypeScript,string,firstName,Person,lastName,语法,person From: https://www.cnblogs.com/friend/p/17202610.html