vue3+elementPlus cron组件

组件代码

使用:

复制代码
<template>
  <div class="vuecron ">
    
    <el-input v-model="state.cron" placeholder="cron表达式..." @click="togglePopover(true)">
      <template #append>
        <el-popover v-model:visible="state.cronPopover" width="700px" trigger="manual" placement="top">
            <Vue3Cron
                :cron-value="state.cron"
                @change="changeCron"
                @close="togglePopover(false)"
                max-height="200px"
                i18n="cn"
            ></Vue3Cron>
        </el-popover>
      </template>
      <template #reference>
                <el-button @click="togglePopover(true)">设置</el-button>
            </template>
    </el-input>
    
  </div>
</template>

<script setup>
import Vue3Cron from '@/components/vue3-cron/index.vue'
import { reactive } from 'vue'
  const state = reactive({
      cronPopover: false,
      cron: ''
    })
    const changeCron = (val) => {
      if(typeof(val) !== 'string') return false
      state.cron = val
    }
    const togglePopover = (bol) => {
      state.cronPopover = bol
    }
</script>

<style lang="scss" scoped>
.vuecron {
  width: 400px;
  margin: 0 auto;
  margin-top: 100px;
 
}
</style>
相关推荐
知识分享小能手6 分钟前
微信小程序入门学习教程,从入门到精通,微信小程序开发进阶(7)
前端·javascript·学习·程序人生·微信小程序·小程序·vue3
叫兽~~43 分钟前
vite vue 打包后运行,路由首页加载不出来
vue.js·vue
sophie旭2 小时前
一道面试题,开始性能优化之旅(8)-- 构建工具和性能
前端·面试·性能优化
市民中心的蟋蟀2 小时前
第三章 钩入React 【上】
前端·react.js·架构
Holin_浩霖2 小时前
为什么typeof null 返回 "object" ?
前端
PanZonghui2 小时前
Zustand 实战指南:从基础到高级,构建类型安全的状态管理
前端·react.js
PanZonghui2 小时前
Vite 构建优化实战:从配置到落地的全方位性能提升指南
前端·react.js·vite
_extraordinary_3 小时前
Java Linux --- 基本命令,部署Java web程序到线上访问
java·linux·前端
用户1456775610373 小时前
推荐一个我私藏的电脑神器:小巧、无广、功能强到离谱
前端
用户1456775610373 小时前
终于找到了!一个文件搞定PDF阅读
前端