Vue3【三】 使用TS自己编写APP组件

Vue3【三】 使用TS自己编写APP组件

运行截图

在这里插入图片描述

目录结构

注意目录层级

在这里插入图片描述

文件源码

APP.vue
<template>
    <div class="app">
        <h1>你好世界!</h1>
    </div>
</template>

<script lang="ts">
export default {
    name:'App' //组件名字
}

</script>

<style>
    .app {
        background-color: #4fffbb;
        box-shadow: 0 0 10px;
        border-radius: 10px;
        padding: 20px;
    }
</style>
main.ts
// 引入createApp用于创建应用
import {createApp} from 'vue'
// 引入APP根组件
import App from './App.vue'

createApp(App).mount('#app')
index.html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <link rel="icon" href="/favicon.ico">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vite App</title>
  </head>
  <body>
    <div id="app"></div>
    <script type="module" src="/src/main.ts"></script>
  </body>
</html>

相关推荐

  1. vue3+TS使用component 的实例

    2024-06-06 11:54:04       29 阅读
  2. 使用vue3编写一个插

    2024-06-06 11:54:04       19 阅读
  3. Vue3 ts使用echarts

    2024-06-06 11:54:04       15 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-06-06 11:54:04       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-06-06 11:54:04       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-06-06 11:54:04       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-06-06 11:54:04       18 阅读

热门阅读

  1. 固定数量点云采样算法

    2024-06-06 11:54:04       8 阅读
  2. 自然语言处理(NLP)中的迁移学习

    2024-06-06 11:54:04       8 阅读
  3. 只需三步,使用 KRaft 建立多节点 Kafka 集群

    2024-06-06 11:54:04       12 阅读
  4. vue进阶

    2024-06-06 11:54:04       8 阅读
  5. Github 2024-06-02 开源项目日报Top10

    2024-06-06 11:54:04       10 阅读
  6. mac设置截屏的默认保存位置

    2024-06-06 11:54:04       10 阅读
  7. Harmonyos Next——图片上传与下载

    2024-06-06 11:54:04       9 阅读
  8. WPF 委托

    2024-06-06 11:54:04       9 阅读