0.0.11 • Published 1 year ago
@wanghaofeng/tools v0.0.11
安装
pnpm add @wanghaofeng/tools
# or
yarn add @wanghaofeng/tools
使用
to 函数
// demo.ts
import { to } from '@wanghaofeng/tools'
const fetchSomething = asyncc () => {
const [err, res] = await to(fetch('xxxx'))
return res?.json()
}
storage
import { storage } from "@wanghaofeng/tools";
storage.setLs("test", { a: 1, b: 2 });
storage.getLs("test");
storage.delLs("test");
systemUpdate
- vue 项目使用
<!-- App.vue -->
<template>
<!-- ........... -->
</template>
<script setup lang="ts">
import { SystemUpdate } from '@wanghaofeng/tools'
import { onMounted, onUnMounted, ref } from 'vue'
import { ElMessage } from 'element-plus'
const su = ref<SystemUpdate>(null)
onMounted(() => {
su.value = new SystemUpdate(30)
su.value.on(() => {
ElMessage({
message: '系统有更新,请重新清理下浏览器缓存,重新加载页面',
type: 'warning',
})
})
)
onUnMounted(() => {
su.value.destroy()
})
</script>
git config --global http.sslVerify false git config --global --unset https.proxy git config --global --unset http.proxy