随笔分类 - typescript
摘要:const toString = Object.prototype.toString; /** * @description: 判断值是否未某个类型 */ export function is(val: unknown, type: string) { return toString.call(va
阅读全文
摘要:httpEnum.ts /** * @description: 请求结果集 */ export enum ResultEnum { SUCCESS = 200, ERROR = 500, TIMEOUT = 408, TYPE = 'success', } /** * @description: 请
阅读全文
摘要:内容摘自 navie vue3 typescript admin ui // 默认缓存期限为7天 const DEFAULT_CACHE_TIME = 60 * 60 * 24 * 7; /** * 创建本地缓存对象 * @param {string=} prefixKey - * @param {
阅读全文
摘要:在 src 下 创建 store 文件夹 在文件夹下创建 index.ts 文件 内容 import type { App } from 'vue'; import { createPinia } from 'pinia'; const store = createPinia(); export f
阅读全文
摘要:使用 ref 读取创建参数 <script lang="ts" setup> import {ref} from "vue"; let message = ref("25"); function chengMsg(){ message.value = "33"; } </script>
阅读全文
摘要:在src创建 plugins 文件夹 在 plugins 文件夹下创建 index.ts naive.ts 文件 index.ts export { setupNaive } from '@/plugins/naive'; naive.ts import type { App } from 'vue
阅读全文
摘要:在 tsconfig.json 文件中添加,位置是paths内 "/#/*": [ "types/*" ] { "compilerOptions": { "target": "esnext", "module": "esnext", "strict": true, "jsx": "preserve"
阅读全文