generated from VLADIMIR/template_frontend
update editor
This commit is contained in:
@@ -7,9 +7,17 @@ import { Key24Regular } from '@vicons/fluent'
|
||||
import type { Application, Door, Key, Place } from '@/api/generated/crabs/evening_detective_server'
|
||||
|
||||
const props = defineProps({
|
||||
newPlaceCode: {
|
||||
type: String,
|
||||
},
|
||||
newPlaceName: {
|
||||
type: String,
|
||||
},
|
||||
newPlaceText: {
|
||||
type: String,
|
||||
},
|
||||
place: {
|
||||
type: Object as PropType<Place>,
|
||||
required: true,
|
||||
},
|
||||
mode: {
|
||||
type: String,
|
||||
@@ -17,9 +25,22 @@ const props = defineProps({
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits<{ 'update:mode': [value: string] }>()
|
||||
const emit = defineEmits<{
|
||||
'update:newPlaceCode': [value: string],
|
||||
'update:newPlaceName': [value: string],
|
||||
'update:newPlaceText': [value: string],
|
||||
'update:mode': [value: string]
|
||||
}>()
|
||||
const updateCode = (code: string) => {
|
||||
emit('update:newPlaceCode', code)
|
||||
}
|
||||
const updateName = (name: string) => {
|
||||
emit('update:newPlaceName', name)
|
||||
}
|
||||
const updateText = (text: string) => {
|
||||
emit('update:newPlaceText', text)
|
||||
}
|
||||
const updateMode = (mode: string) => {
|
||||
console.log(mode)
|
||||
emit('update:mode', mode)
|
||||
}
|
||||
|
||||
@@ -53,9 +74,13 @@ function onCreateKey(): Key {
|
||||
<div v-if="mode == 'add'" class="place-block">
|
||||
<n-space vertical>
|
||||
<n-input-group>
|
||||
<n-input :style="{ width: '20%' }" v-model:value="props.place.code" type="text" placeholder="Ы-1" />
|
||||
<n-input :style="{ width: '80%' }" v-model:value="props.place.name" type="text" placeholder="Дом №Ы" />
|
||||
<n-input :style="{ width: '20%' }" :value="newPlaceCode" @update:value="updateCode" type="text"
|
||||
placeholder="Ы-1" />
|
||||
<n-input :style="{ width: '80%' }" :value="newPlaceName" @update:value="updateName" type="text"
|
||||
placeholder="Дом №Ы" />
|
||||
</n-input-group>
|
||||
<n-input :value="newPlaceText" @update:value="updateText" type="textarea" :autosize="{ minRows: 3 }"
|
||||
placeholder="В начале было слово..." />
|
||||
<slot></slot>
|
||||
</n-space>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user