相关疑难解决方法(0)

Vue 3 + Vite + Typescript - 开发和构建未拾取 TS 错误

我正在使用 Vue 3、Vite 和 TypeScript。我想尝试使用 TypeScript 构建 Vue 项目。到目前为止,配置确实很困难。我一直在查看各种文档,但我正在努力实现我的目标。如果代码有问题,项目不应构建并抛出错误。

我附上下面的代码,我想寻求帮助。

应用程序.vue

<template>
  <header>
    <h1>The Learning Resources App</h1>
  </header>
</template>

<script lang="ts">
import { defineComponent } from 'vue';

// import StoredResource from '//StoredResource';

interface VueData {
  storedResources: StoredResource[];
}

export default defineComponent({
  name: 'App',
  data(): VueData {
    return {
      storedResources: [
        {
          id: 'official-guide' as number,
          title: 'Official Guide',
          description: 'The official Vue.js documentation.',
          link: 'https://vuejs.org/',
        },
        {
          id: 'google',
          title: 'Google',
          description: 'Learn to google...',
          link: 'https://www.google.co.uk/',
        },
      ],
    }; …
Run Code Online (Sandbox Code Playgroud)

typescript vue.js vite

25
推荐指数
3
解决办法
2万
查看次数

标签 统计

typescript ×1

vite ×1

vue.js ×1