New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@coder-txd/cron-editor

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coder-txd/cron-editor

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

latest
npmnpm
Version
1.0.7
Version published
Maintainers
1
Created
Source

vue-crontab

vue 的 cron 组件,支持解析/反解析 cron 表达式,生成最近五次的符合条件时间,依赖 vue2 和 element-ui

根据@illidanj的项目进行二次开发,英文版本(部分校验提示文字未转换)

安装方式

npm install @coder-txd/cron-editor

引入方式

//全局引入
import vcrontab from "@coder-txd/cron-editor";
Vue.use(vcrontab); //使用方式:<vcrontab></vcrontab>

//单独引入
import vcrontab from "@coder-txd/cron-editor";
export default {
  components: { vcrontab },
};

代码示例

<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 'cronEditor'
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']

  • defaultExpression 默认cron表达式,重置后cron会被设置为该值,默认为 * * * * * ?

方法

  • fill 点击确定时,把选择好的值返回。

  • hide 关闭组件时的回调

Keywords

cron

FAQs

Package last updated on 04 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts