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>
相关推荐
雾恋14 小时前
最近一年的感悟
前端·javascript·程序员
华仔啊14 小时前
Vue3 的 ref 和 reactive 到底用哪个?90% 的开发者都选错了
javascript·vue.js
A黄俊辉A15 小时前
axios+ts封装
开发语言·前端·javascript
小李小李不讲道理15 小时前
「Ant Design 组件库探索」四:Input组件
前端·javascript·react.js
连合机器人16 小时前
晨曦中的守望者:当科技为景区赋予温度
java·前端·科技
郑板桥3016 小时前
tua-body-scroll-lock踩坑记录
前端·javascript
IT古董16 小时前
Vue + Vite + Element UI 实现动态主题切换:基于 :root + SCSS 变量的最佳实践
vue.js·ui·scss
解道Jdon17 小时前
SpringBoot4与Spring7发布:云原生深度进化
javascript·reactjs
慢半拍iii17 小时前
JAVA Web —— A / 网页开发基础
前端
gnip17 小时前
pnpm 的 monorepo架构多包管理
前端·javascript