22 <q-card
33 flat
44 bordered
5- v-bind: class =" [' bg-formcard', ' q-pa-md', authorErrors.hasError ? 'red-border' : ''] "
5+ class =" bg-formcard q-pa-md"
66 >
77 <div class =" row" >
88 <q-input
1717 v-bind:error =" givenNamesError.hasError"
1818 v-bind:error-message =" givenNamesError.messages.join(', ')"
1919 v-on:update:modelValue =" $emit('update', 'givenNames', $event)"
20+ ref =" givenNamesRef"
2021 />
2122 </div >
2223 <div class =" row" >
9495 bg-color =" white"
9596 class =" col"
9697 dense
98+ hint =" Format: https://orcid.org/0000-0000-0000-0000"
9799 label =" orcid"
98100 outlined
99101 standout
106108 </div >
107109
108110 <q-banner
109- v-if =" authorErrors.hasError && authorErrors. messages.length > 0"
111+ v-if =" authorErrors.messages.length > 0"
110112 class =" bg-warning text-negative"
111113 >
112114 <div
153155
154156<script lang="ts">
155157/* eslint-disable @typescript-eslint/restrict-template-expressions */
156- import { computed , defineComponent } from ' vue'
158+ import { computed , defineComponent , onMounted , ref } from ' vue'
157159import { getMyErrors } from ' src/store/validator'
158160import { authorErrors } from ' src/author-errors'
159161
@@ -198,7 +200,12 @@ export default defineComponent({
198200 }
199201 },
200202 setup (props ) {
203+ const givenNamesRef = ref <HTMLElement | null >(null )
204+ onMounted (() => {
205+ givenNamesRef .value ?.focus ()
206+ })
201207 return {
208+ givenNamesRef ,
202209 givenNamesError: computed (() => getMyErrors (` /authors/${props .index }/given-names ` )),
203210 nameParticleError: computed (() => getMyErrors (` /authors/${props .index }/name-particle ` )),
204211 familyNamesError: computed (() => getMyErrors (` /authors/${props .index }/family-names ` )),
@@ -207,6 +214,7 @@ export default defineComponent({
207214 affiliationError: computed (() => getMyErrors (` /authors/${props .index }/affiliation ` )),
208215 orcidError: computed (() => getMyErrors (` /authors/${props .index }/orcid ` )),
209216 authorErrors: computed (() => authorErrors (props .index ))
217+
210218 }
211219 },
212220 emits: [' closePressed' , ' removePressed' , ' update' , ' moveUp' , ' moveDown' ]
0 commit comments