About This Site http://doc.fly2you.cn

lipengjunSeptember 11, 2022
  • Notes
  • Explain
About 2 min

About This Site http://doc.fly2you.cnopen in new window

Vue 3 + TypeScript + Vite + VuePress 2 + Element Plus

This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 <script setup> SFCs, check out the script setup docsopen in new window to learn more.

Type Support For .vue Imports in TS

Since TypeScript cannot handle type information for .vue imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in .vue imports (for example to get props validation when using manual h(...) calls), you can enable Volar's Take Over mode by following these steps:

  1. Run Extensions: Show Built-in Extensions from VS Code's command palette, look for TypeScript and JavaScript Language Features, then right click and select Disable (Workspace). By default, Take Over mode will enable itself if the default TypeScript extension is disabled.
  2. Reload the VS Code window by running Developer: Reload Window from the command palette.

technology-stack

Catalogue

The docs project is created by vite-cli.

├── docs                       // docs catalogue
│   ├── .vuepress              // vuepress
│   │    ├── components        // components
│   │    ├── config            // config file
│   │    ├── public            // static
│   │    ├── styles            // scss
│   │    ├── client.ts         // vuepress client
│   │    ├── config.ts         // vuepress config
│   │    └── theme.ts          // vuepress theme
├── .gitignore                 // gitignore
├── deployDoc.sh               // deploy
└── package.json               // package.json

package.json

{
  "name": "docfly2you",
  "version": "1.0.0",
  "description": "Weitong Docs",
  "type": "module",
  "scripts": {
    "docs:dev": "vuepress dev docs",
    "docs:build": "vuepress build docs"
  },
  "keywords": [
    "platform-wechat-mall"
  ],
  "author": "lipengjun",
  "license": "Apache-2.0",
  "directories": {
    "doc": "docs"
  },
  "dependencies": {
    "@element-plus/icons-vue": "^2.0.9",
    "@vue/reactivity": "^3.2.38",
    "@vue/shared": "^3.2.38",
    "@vuepress/utils": "^2.0.0-beta.51",
    "element-plus": "^2.2.14",
    "gitalk": "^1.8.0",
    "sass": "^1.54.8",
    "vue": "^3.2.25",
    "vuepress-theme-hope": "^2.0.0-beta.97"
  },
  "devDependencies": {
    "@babel/core": "^7.18.13",
    "@vitejs/plugin-vue": "^2.3.3",
    "vuepress": "2.0.0-beta.51",
    "@vuepress/client": "2.0.0-beta.51",
    "@vuepress/plugin-register-components": "^2.0.0-beta.51",
    "@vuepress/plugin-docsearch": "next",
    "vuepress-plugin-md-enhance": "next",
    "vuepress-plugin-photo-swipe": "next",
    "postcss": "^8.4.16",
    "postcss-cli": "^10.0.0",
    "vite": "^2.9.9",
    "vitest": "^0.18.0",
    "vue-baidu-analytics": "^2.2.0"
  }
}

install

npm install

# run
npm run docs:dev

if slowly to run:

npm install -g cnpm --registry=https://registry.npm.taobao.org

cnpm i

# run
npm run docs:dev

open chrome http://localhost:8080

build

npm run docs:build

nginx config

server {
    listen 80;
    server_name doc.fly2you.cn;
    
    location / {
        root '/home/doc';
        index index.html;
    }
}