1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
| <template>
| <div id="app">
| <div class="box">
| <el-input v-model="input" placeholder class="inp" />
| <el-button type="primary" @click="showDialog">生成 cron</el-button>
| </div>
| <el-dialog title="生成 cron" :visible.sync="showCron">
| <vcrontab :expression="expression" @hide="showCron=false" @fill="crontabFill" />
| </el-dialog>
| </div>
| </template>
| <script>
| import vcrontab from 'vcrontab'
|
| export default {
| components: { vcrontab },
| data() {
| return {
| input: '',
| expression: '',
| showCron: false,
| cronExpression: '*/1 * * * *',
| form: {},
| formLabelWidth: '120px'
| // showCron: false
| }
| },
| methods: {
| crontabFill(value) {
| // 确定后回传的值
| this.input = value
| },
| showDialog() {
| this.expression = this.input
| // 传入的 cron 表达式,可以反解析到 UI 上
| this.showCron = true
| }
| }
| }
| </script>
| }
|
|