npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@tudan110/vue2-crontab

v1.0.0

Published

支持 Vue 2 的 Vue.js 单文件组件模板

Downloads

4

Readme

Vue2Crontab

Vue2Crontab

基于 element-ui,支持 Vue 2 的 crontab 组件。

截图

home.png

crontab.png

安装

确保先安装依赖:

# sh
npm install

开发

启动开发服务:

npm run dev

构建

构建库用于生产或发布:

npm run lib

构建示例项目用于生产或发布:

npm run build

检查并修复文件

npm run lint

发布包到 npm

登录 npm 库

npm login

发布

npm publish --access public

如何使用 lib 文件?

注意

确保你的项目中已经安装并注册了 element-ui

import Vue from 'vue'
import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

Vue.use(Element)

npm 安装

npm i vue2-crontab

全局导入

在 main.js 中导入并注册组件

import Vue from 'vue'
import Vue2Crontab from 'vue2-crontab'

Vue.use(Vue2Crontab)

手动导入

import Vue2Crontab from 'vue2-crontab'

export default {
    components: {
        Vue2Crontab
    }
}

不使用构建工具或通过 CDN 引入

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <link rel="icon" href="/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vite App</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
    <!-- 确保你的当前目录有该产物 -->
    <script src="/lib/vue2-crontab.umd.js"></script>
    <style>
        #app {
            font-family: Avenir, Helvetica, Arial, sans-serif;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            text-align: center;
            color: #2c3e50;
            margin-top: 60px;
        }
    </style>
</head>
<body>
<div id="app">
    <vue2-crontab></vue2-crontab>
</div>
</body>
<script>
    var app = new Vue({
        el: '#app'
    })
</script>
</html>

示例

<template>
  <div id="app">

    <div class="container">

      <h1>Vue2Crontab</h1>

      <!-- 表单 -->
      <el-form :model="form" :inline="true" label-width="110px">
        <el-form-item label="执行时间" prop="cronExpression">
          <el-input
              v-model="form.cronExpression"
              placeholder="请输入执行时间"
              clearable
              @focus="showCron=true"
          />
        </el-form-item>

      </el-form>

      <!-- cron 组件 -->
      <el-dialog title="执行时间" :visible.sync="showCron">
        <vue2-crontab @hide="showCron=false" @fill="crontabFill" :expression="form.cronExpression"></vue2-crontab>
      </el-dialog>

    </div>

  </div>

</template>

<script>
  export default {
    name: 'App',
    components: {},
    data() {
      return {
        showCron: false,
        form: {
          cronExpression: null,
        }
      }
    },
    methods: {
      crontabFill(value) {
        this.form.cronExpression = value
      },
    }
  }
</script>

<style scoped>
  #app {
    font-family: Avenir, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin-top: 60px;
  }

  .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100vh;
  }
</style>

License

Made with ❤️

Published under MIT License.