mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-12-02 21:26:42 +01:00
34 lines
553 B
JavaScript
Vendored
34 lines
553 B
JavaScript
Vendored
// import { ref } from 'vue'
|
|
|
|
export function useIdGenerator(fieldType, fieldName) {
|
|
let prefix
|
|
fieldName = fieldName.toString()
|
|
|
|
switch (fieldType) {
|
|
case 'text':
|
|
prefix = 'txt'
|
|
break
|
|
case 'button':
|
|
prefix = 'btn'
|
|
break
|
|
case 'email':
|
|
prefix = 'eml'
|
|
break
|
|
case 'password':
|
|
prefix = 'pwd'
|
|
break
|
|
case 'radio':
|
|
prefix = 'rdo'
|
|
break
|
|
case 'label':
|
|
prefix = 'lbl'
|
|
break
|
|
default:
|
|
prefix = 'txt'
|
|
break
|
|
}
|
|
|
|
return {
|
|
inputId: prefix + fieldName[0].toUpperCase() + fieldName.toLowerCase().slice(1)
|
|
}
|
|
} |