Giter Site home page Giter Site logo

vite-ts-quick's Introduction

Installation

use npx degit pohunchn/vite-ts-quick#main my-project or git clone ... pull code.

After pulling the code, execute npm install in the root directory of the project. After success, execute npm run dev to start the project (nodejs + npm needs to be installed)

Others Template

Built-in

Note

  • This framework adopts Fetch as a network requester, it is not recommended to introduce Axios again
  • Please do not modify all the files under the lib folder in the business project
  • It is recommended that the custom root library be inherited from lib/ts/Base
  • gitee is only for domestic users to pull code,from github to synchronize,please visit github for PR
  • Welcome to Issues and PR

How to use vue3

Vue 3 + Typescript + Vite

This template should help get you started developing with Vue 3 and Typescript in Vite.

Recommended IDE Setup

VSCode + Vetur. Make sure to enable vetur.experimental.templateInterpolationService in settings!

If Using <script setup>

<script setup> is a feature that is currently in RFC stage. To get proper IDE support for the syntax, use Volar instead of Vetur (and disable Vetur).

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 use the following:

If Using Volar

Run Volar: Switch TS Plugin on/off from VSCode command palette.

If Using Vetur

  1. Install and add @vuedx/typescript-plugin-vue to the plugins section in tsconfig.json
  2. Delete src/shims-vue.d.ts as it is no longer needed to provide module info to Typescript
  3. Open src/main.ts in VSCode
  4. Open the VSCode command palette 5. Search and run "Select TypeScript version" -> "Use workspace version"

vite-ts-quick's People

Contributors

orziz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vite-ts-quick's Issues

打包后路由有问题

打包后会出现“Error: Unknown variable dynamic import :”的问题

/** 以下代码不要修改 */
function loadRouters() {
	const context = import.meta.globEager("../views/**/*.vue");
    const routes: RouteRecordRaw[] = [];

    Object.keys(context).forEach((key: any) => {
        if (key === "./index.ts") return;
		let name = key.replace(/(\.\.\/views\/|\.vue)/g, '');
		let path = "/" + name.toLowerCase();
		if (name === "Index") path = "/";
		routes.push({
			path: path,
			name: name,
			component: () => import(`../views/${name}.vue`)
		})
    });

    return { context, routes }
}

需要更改为如下

/** 以下代码不要修改 */
function loadRouters() {
	const context = import.meta.globEager("../views/**/*.vue");
    const routes: RouteRecordRaw[] = [];

    Object.keys(context).forEach((key: any) => {
        if (key === "./index.ts") return;
		let name = key.replace(/(\.\.\/views\/|\.vue)/g, '');
		let path = "/" + name.toLowerCase();
		if (name === "Index") path = "/";
		routes.push({
			path: path,
			name: name,
			component: () => context[`../views/${name}.vue`]
		})
    });

    return { context, routes }
}

Vuex HMR not working

Greetings! I'm trying to setup HMR for Vite + Vuex, found this project, but it seems that HMR is not working for modules in store here, though it is perfectly working for components.

Steps to reproduce:

  • git clone project
  • yarn
  • yarn dev
  • open dev server url in browser
  • change something in src/store/modules/user.ts and save changes
  • notice full page reload instead of hmr update

Will be glad of any help in this matter, thank you!

could not find commit hash for HEAD

I try to running:
npx degit pohunchn/vite-ts-quick web
gives me:
! could not fetch remote https://github.com/pohunchn/vite-ts-quick ! could not find commit hash for HEAD
I checked system enivroment path and update git latest.
It's not used.

为什么用fetch来代替axios作为http请求呢?

为什么用fetch来代替axios作为http请求呢?
大部分都习惯了用axios啊,感觉用axios的话会比较顺手。
为啥要用fetch呢?有什么优势么?而且有些旧浏览器好像大支持fetch吧

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.