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>
相关推荐
江城开朗的豌豆10 分钟前
JavaScript篇:自定义事件:让你的代码学会'打小报告'
前端·javascript·面试
ai产品老杨1 小时前
减少交通拥堵、提高效率、改善交通安全的智慧交通开源了。
前端·vue.js·算法·ecmascript·音视频
lexiangqicheng1 小时前
JS-- for...in和for...of
开发语言·前端·javascript
smallluan1 小时前
JS设计模式(4):观察者模式
javascript·观察者模式·设计模式
粥里有勺糖1 小时前
视野修炼-技术周刊第122期 | 发光图片制作
前端·javascript·github
y102121041 小时前
Python训练营打卡Day42
开发语言·javascript·ecmascript
Carlos_sam2 小时前
OpenLayers:封装Tooltip
前端·javascript
张老爷子2 小时前
记录uniapp开发安卓使用webRTC实现语音推送
vue.js
工呈士2 小时前
MobX与响应式编程实践
前端·react.js·面试
嘉小华2 小时前
Android Lifecycle 使用
前端