https://github.com/coajs/coa-nuxt
一个基于Nuxt的前端集成框架,包含了Nuxt基本框架、常用方法、必要的第三方类库
https://github.com/coajs/coa-nuxt
coa coa-nuxt coajs nuxt
Last synced: about 2 months ago
JSON representation
一个基于Nuxt的前端集成框架,包含了Nuxt基本框架、常用方法、必要的第三方类库
- Host: GitHub
- URL: https://github.com/coajs/coa-nuxt
- Owner: coajs
- Created: 2020-05-09T02:36:35.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2023-01-07T04:50:44.000Z (over 2 years ago)
- Last Synced: 2025-03-30T13:03:46.646Z (2 months ago)
- Topics: coa, coa-nuxt, coajs, nuxt
- Language: TypeScript
- Homepage: https://npmjs.com/coa-nuxt
- Size: 1.07 MB
- Stars: 0
- Watchers: 0
- Forks: 2
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# coa-nuxt
[](LICENSE)
[](https://www.npmjs.org/package/coa-nuxt)
[](http://npm-stat.com/charts.html?package=coa-nuxt)
[](https://github.com/coajs/coa-nuxt/pulls)一个基于 Nuxt 的前端集成框架,包含了 Nuxt 基本框架、常用方法、必要的第三方类库
## 使用说明
### 安装
```shell
yarn add coa-nuxt
```### 框架
🚧 文档建设中
### 组件
- [Gateway 接口网关](#Gateway)
- [storage 储存](#storage)
- [time 时间](#time)
- [echo 输出](#echo)
- [die 终止](#die)#### Gateway 接口网关
🚧 文档建设中
#### storage 储存
```typescript
import { storage } from 'coa-nuxt'// 设置本地储存
storage.local.set('key1', { info: 'value1' }, 10 * 60 * 1000 /*10分钟有效期*/)
// 获取本地储存
storage.local.get('key1')// 设置会话储存
storage.session.set('key2', { info: 'value2' }, 10 * 60 * 1000 /*10分钟有效期*/)
// 获取会话储存
storage.session.get('key2')
```#### time 时间
time 包含了一些常用时间常量,单位为毫秒
```typescript
import { time } from 'coa-nuxt'// 1秒钟 1000
time.oneSecond
// 1分钟 60*1000
time.oneMinute
// 1小时 60*60*1000
time.oneHour
// 1天 24*60*60*1000
time.oneDay
// 1周 7*24*60*60*1000
time.oneWeek
// 1个月 30*24*60*60*1000
time.oneMonth
// 1年 365*24*60*60*1000
time.oneYear
// 1世纪 100*365*24*60*60*1000
time.oneCentury
// 永久(100世纪) 100*100*365*24*60*60*1000
time.forever
```#### echo 输出
```typescript
import { echo } from 'coa-nuxt'// 输出一个信息
echo.log('this is message')// 输出一个信息并报错
echo.error('this is message with error')
```#### die 终止
```typescript
import { die } from 'coa-nuxt'// 终止代码运行并给出提示信息
die.hint('error message')
```### 第三方库
包含以下第三方库
- [dayjs](https://day.js.org/zh-CN)
- [lodash](https://lodash.com)```typescript
// 获取 dayjs 对象,dayjs的使用详见 https://day.js.org/zh-CN
import { dayjs } from 'coa-nuxt'// 获取 lodash 对象,lodash的使用详见 https://lodash.com
import { lodash } from 'coa-nuxt'// lodash 存在别名 _ ,也可以直接导入
import { _ } from 'coa-nuxt'
```