option.js 734 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { createOption, destroyOption, assemOption } from './util'
  2. const props = {
  3. value: null,
  4. label: { type: [String, Number, Boolean], default: '' },
  5. visible: { type: Boolean, default: null },
  6. disabled: Boolean
  7. }
  8. const watch = {}
  9. Object.keys(props).forEach(name => {
  10. watch[name] = function (value) {
  11. this.optionConfig.update(name, value)
  12. }
  13. })
  14. export default {
  15. name: 'VxeOption',
  16. props,
  17. inject: {
  18. $xeselect: {
  19. default: null
  20. },
  21. $xeoptgroup: {
  22. default: null
  23. }
  24. },
  25. watch,
  26. mounted () {
  27. assemOption(this)
  28. },
  29. created () {
  30. this.optionConfig = createOption(this.$xeselect, this)
  31. },
  32. destroyed () {
  33. destroyOption(this)
  34. },
  35. render (h) {
  36. return h('div')
  37. }
  38. }