| 1 | <template> |
| 2 | <template v-if="['tcp', 'udp'].includes(form.type)"> |
| 3 | <div class="field-row two-col"> |
| 4 | <ConfigField label="Remote Port" type="number" v-model="form.remotePort" |
| 5 | :min="0" :max="65535" prop="remotePort" tip="Use 0 for random port assignment" :readonly="readonly" /> |
| 6 | <div></div> |
| 7 | </div> |
| 8 | </template> |
| 9 | <template v-if="['http', 'https', 'tcpmux'].includes(form.type)"> |
| 10 | <div class="field-row two-col"> |
| 11 | <ConfigField label="Custom Domains" type="tags" v-model="form.customDomains" |
| 12 | prop="customDomains" placeholder="example.com" :readonly="readonly" /> |
| 13 | <ConfigField v-if="form.type !== 'tcpmux'" label="Subdomain" type="text" |
| 14 | v-model="form.subdomain" placeholder="test" :readonly="readonly" /> |
| 15 | <ConfigField v-if="form.type === 'tcpmux'" label="Multiplexer" type="select" |
| 16 | v-model="form.multiplexer" :options="[{ label: 'HTTP CONNECT', value: 'httpconnect' }]" :readonly="readonly" /> |
| 17 | </div> |
| 18 | </template> |
| 19 | </template> |
| 20 | |
| 21 | <script setup lang="ts"> |
| 22 | import { computed } from 'vue' |
| 23 | import type { ProxyFormData } from '../../types' |
| 24 | import ConfigField from '../ConfigField.vue' |
| 25 | |
| 26 | const props = withDefaults(defineProps<{ |
| 27 | modelValue: ProxyFormData |
| 28 | readonly?: boolean |
| 29 | }>(), { readonly: false }) |
| 30 | |
| 31 | const emit = defineEmits<{ 'update:modelValue': [value: ProxyFormData] }>() |
| 32 | |
| 33 | const form = computed({ |
| 34 | get: () => props.modelValue, |
| 35 | set: (val) => emit('update:modelValue', val), |
| 36 | }) |
| 37 | </script> |
| 38 | |
| 39 | <style scoped lang="scss"> |
| 40 | @use '@/assets/css/form-layout'; |
| 41 | </style> |