index.vue 510 B

12345678910111213141516171819202122232425262728
  1. <template>
  2. <a-input
  3. :value="hostName"
  4. :placeholder="isWindows ? $t('compute.validate.windows') : $t('compute.validate.others')"
  5. @change="handleHostNameChange" />
  6. </template>
  7. <script>
  8. export default {
  9. name: 'HostName',
  10. props: ['value', 'isWindows'],
  11. data () {
  12. return {
  13. hostName: this.value,
  14. }
  15. },
  16. watch: {
  17. value (val) {
  18. this.hostName = val
  19. },
  20. },
  21. methods: {
  22. handleHostNameChange (e) {
  23. this.$emit('change', e.target.value)
  24. },
  25. },
  26. }
  27. </script>