fc9a095edc2b3e21b3cbb0042ce65395d4e688f1.svn-base 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <div class="components-input-demo-presuffix">
  3. <a-input @click="openModal" placeholder="cron表达式" v-model="cron" @change="(e)=>handleOK(e.target.value)">
  4. <a-icon slot="prefix" type="schedule" title="cron控件"/>
  5. <a-icon v-if="cron" slot="suffix" type="close-circle" @click="handleEmpty" title="清空"/>
  6. </a-input>
  7. <JCronModal ref="innerVueCron" :data="cron" @ok="handleOK"></JCronModal>
  8. </div>
  9. </template>
  10. <script>
  11. import JCronModal from "./modal/JCronModal";
  12. export default {
  13. name: 'JCron',
  14. components: {
  15. JCronModal
  16. },
  17. props: {
  18. value: {
  19. required: false,
  20. type: String,
  21. }
  22. },
  23. data(){
  24. return {
  25. cron: this.value,
  26. }
  27. },
  28. watch:{
  29. value(val){
  30. this.cron = val
  31. }
  32. },
  33. methods:{
  34. openModal(){
  35. this.$refs.innerVueCron.show();
  36. },
  37. handleOK(val){
  38. this.cron = val;
  39. this.$emit("change", this.cron);
  40. //this.$emit("change", Object.assign({}, this.cron));
  41. },
  42. handleEmpty(){
  43. this.handleOK('')
  44. }
  45. },
  46. model: {
  47. prop: 'value',
  48. event: 'change'
  49. }
  50. }
  51. </script>
  52. <style scoped>
  53. .components-input-demo-presuffix .anticon-close-circle {
  54. cursor: pointer;
  55. color: #ccc;
  56. transition: color 0.3s;
  57. font-size: 12px;
  58. }
  59. .components-input-demo-presuffix .anticon-close-circle:hover {
  60. color: #f5222d;
  61. }
  62. .components-input-demo-presuffix .anticon-close-circle:active {
  63. color: #666;
  64. }
  65. </style>