(四)演示 ref 定义类型

老怪兽2022年11月30日
  • TypeScript
  • Ts和Vue
小于 1 分钟

一、开发中 ref 定义类型

<script setup lang="ts">
import { ref } from 'vue'

interface Product {
    id: number,
    title: string,
    price: number,
    isStock: boolean,
}

const priducts = ref<Product[]>([
    {
        id: 1,
        title: '牛仔裤',
        price: 200,
        isStock: true
    }        
])
</script>
Loading...