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