Vue 3 + TypeScript + Vite
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 docs to learn more.
依赖
注意: 1.可能会报Unable to preventDefault inside passive event listener invocation 这是无关紧要的 不是报错 可以通过去掉default-passive-events依赖解决 并加入brower_patch.ts文件: interface EventTarget { func: ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void) | null; }
(function () { if (typeof EventTarget !== "undefined") { let func = EventTarget.prototype.addEventListener; EventTarget.prototype.addEventListener = function (type: string, fn: EventListenerOrEventListenerObject, capture?: boolean | AddEventListenerOptions) { (this as any).func = func; if (typeof capture !== "boolean") { capture = capture || {}; (capture as AddEventListenerOptions).passive = false; } (this as any).func.call(this, type, fn, capture); }; } })(); 在main.ts中引用 import '@/patchto/browser_patch'