index.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <a-form-item>
  3. <a-radio-group v-decorator="decorator" @change="handleMachineChange">
  4. <a-radio-button :value="opt.value" v-for="opt in machineOptions" :key="opt.value">{{ opt.text }}</a-radio-button>
  5. </a-radio-group>
  6. </a-form-item>
  7. </template>
  8. <script>
  9. export default {
  10. name: 'Machine',
  11. props: {
  12. decorator: {
  13. type: Array,
  14. required: true,
  15. },
  16. isArm: {
  17. type: Boolean,
  18. required: true,
  19. },
  20. showDefault: {
  21. type: Boolean,
  22. },
  23. },
  24. computed: {
  25. machineOptions () {
  26. var options = []
  27. if (this.showDefault) {
  28. options.push({
  29. text: this.$t('compute.text_1'),
  30. value: '',
  31. })
  32. }
  33. if (this.isArm) {
  34. options.push(
  35. {
  36. text: 'VIRT',
  37. value: 'virt',
  38. },
  39. )
  40. } else {
  41. options.push(
  42. {
  43. text: 'PC',
  44. value: 'pc',
  45. },
  46. {
  47. text: 'Q35',
  48. value: 'q35',
  49. },
  50. )
  51. }
  52. return options
  53. },
  54. },
  55. methods: {
  56. handleMachineChange (e) {
  57. this.$emit('change', { value: e.target.value })
  58. },
  59. },
  60. }
  61. </script>