0.3.4-SNAPSHOT β’ Published 4 years ago
vue-smart-cron v0.3.4-SNAPSHOT
vue-smart-cron
a project using vue,element-ui to generate cron expression δΈζ Online demo
Used by
π Attemper: A distributed,multi-tenancy,job-flow scheduling application π
Use(Example)
- Install dependency(npm)
npm install vue-smart-cron
import Vue from 'vue'
import VueI18n from 'vue-i18n'
import elementEnLocale from 'element-ui/lib/locale/lang/en'
import elementZhCNLocale from 'element-ui/lib/locale/lang/zh-CN'
import enUSLocale from './en-US'
import zhCNLocale from './zh-CN'
import { getLocale } from '../util/tools'
Vue.use(VueI18n)
const messages = {
en_US: {
...enUSLocale,
...elementEnLocale
},
zh_CN: {
...zhCNLocale,
...elementZhCNLocale
}
},
i18n = new VueI18n({
// set locale
// options: en | zh
locale: getLocale(),
// set locale messages
messages
})
export default i18n
import Vue from 'vue'
import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import 'vue-smart-cron/src/styles/global.less'
import App from './App'
import i18n from './lang' // Internationalization
Vue.use(Element, {
size: localStorage.getItem('size') || 'small', // set element-ui default size
i18n: (key, value) => i18n.t(key, value)
})
new Vue({
el: '#app',
i18n,
render: h => h(App)
})
- Vue file
<template>
<div id="app">
<el-row>
<el-col :span="6" :offset="9">
<cron-input v-model="cron" @change="change" @reset="reset"/>
</el-col>
</el-row>
</div>
</template>
<script>
import CronInput from 'vue-smart-cron/src/components/cron-input'
import { DEFAULT_CRON_EXPRESSION } from 'vue-smart-cron/src/constant/filed'
export default {
name: 'App',
components: {
CronInput
},
data() {
return {
cron: DEFAULT_CRON_EXPRESSION
}
},
methods: {
change(cron) {
this.cron = cron
},
reset(cron) {
this.cron = DEFAULT_CRON_EXPRESSION
}
}
}
</script>
<style lang="less">
#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>
- Run your project
Build Source Code
# install dependencies
npm install vue-smart-cron
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
0.3.4-SNAPSHOT
4 years ago
0.3.2-SNAPSHOT
4 years ago
0.3.3-SNAPSHOT
4 years ago
0.3.1-SNAPSHOT
4 years ago
0.3.0-SNAPSHOT
4 years ago