# vcrontab

> vue 的 cron 组件，支持解析/反解析 cron 表达式，生成最近五次的符合条件时间

Latest version **0.3.5** (published 2020-05-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install vcrontab
pnpm add vcrontab
yarn add vcrontab
bun add vcrontab
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.3.5 |
| Published | 2020-05-25 |
| First published | 2018-12-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 1.4 MB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 271 |
| Author | smallstone |
| Maintainers | ~smallstone |
| Keywords | cron, vue, vuecron, crontab, vue-crontab |

## Links

- npm: https://www.npmjs.com/package/vcrontab
- Repository: https://github.com/small-stone/vue-crontab
- Homepage: https://small-stone.github.io/vCrontab/dist/
- Issues: https://github.com/small-stone/vue-crontab/issues
- npm.io page: https://npm.io/package/vcrontab

## Dependencies (2)

- [vue](https://npm.io/package/vue.md) ^2.5.17
- [element-ui](https://npm.io/package/element-ui.md) ^2.4.11

## Recent versions

- 0.3.5 (latest) — 2020-05-25
- 0.3.4 — 2020-05-25
- 0.3.3 — 2019-01-02
- 0.3.2 — 2018-12-19
- 0.3.1 — 2018-12-19
- 0.3.0 — 2018-12-19
- 0.2.0 — 2018-12-19
- 0.1.0 — 2018-12-19

## README

# [demo](https://small-stone.github.io/vCrontab/dist/)

![](public/demo.png)

# vue-crontab

vue 的 cron 组件，支持解析/反解析 cron 表达式，生成最近五次的符合条件时间，依赖 vue2 和 element-ui

## 安装方式

```
npm install vcrontab
```

## 引入方式

```javascript
//全局引入
import vcrontab from "vcrontab";
Vue.use(vcrontab); //使用方式：<vcrontab></vcrontab>

//单独引入
import vcrontab from "vcrontab";
export default {
  components: { vcrontab },
};
```

## 代码示例

```javascript
<template>
    <div id="app">
        <div class="box">
            <el-input v-model="input" placeholder class="inp"></el-input>
            <el-button type="primary" @click="showDialog">生成 cron</el-button>
        </div>
        <el-dialog title="生成 cron" :visible.sync="showCron">
            <vcrontab @hide="showCron=false" @fill="crontabFill" :expression="expression"></vcrontab>
        </el-dialog>
    </div>
</template>

<script>
import vcrontab from 'vcrontab'
export default {
    components: { vcrontab },
    data() {
        return {
            input: "",
            expression: "",
            showCron: false
        };
    },
    methods: {
        crontabFill(value) {
            //确定后回传的值
            this.input = value;
        },
        showDialog() {
            this.expression = this.input;//传入的 cron 表达式，可以反解析到 UI 上
            this.showCron = true;
        }
    }
};
</script>
```

## 参数

- expression
  传入的 cron 表达式，可以反解析到 UI 上

- hideComponent
  需要隐藏的组件数组，依次为`['second','min','hour','day','mouth','week','year']`

## 方法

- fill
  点击确定时，把选择好的值返回。

- hide
  关闭组件时的回调

---
_Source: https://npm.io/package/vcrontab · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
