入力ボックスの入力可否の設定を削除し、特定のボタン入力後に入力ボックスの入力可否に変更する。

This commit is contained in:
Mouriya
2024-06-17 03:16:26 +09:00
parent eb89b3f8a6
commit e2a625ba12

View File

@@ -44,6 +44,7 @@ type ButtonConfig = {
label: string; label: string;
color: string; color: string;
type: string; type: string;
editable: boolean;
}; };
export default defineComponent({ export default defineComponent({
@@ -55,10 +56,10 @@ export default defineComponent({
ShowDialog ShowDialog
}, },
props: { props: {
canInput: { // canInput: {
type: Boolean, // type: Boolean,
default: false // default: false
}, // },
appId: { appId: {
type: String, type: String,
}, },
@@ -79,11 +80,14 @@ export default defineComponent({
const currentComponent = ref('FieldAdd'); const currentComponent = ref('FieldAdd');
const sharedText = ref(props.selectedObject?.sharedText ?? ''); const sharedText = ref(props.selectedObject?.sharedText ?? '');
const inputRef = ref(); const inputRef = ref();
const canInput = ref(true);
const editable = ref(false);
const openDialog = (button: ButtonConfig) => { const openDialog = (button: ButtonConfig) => {
currentDialogName.value = button.label; currentDialogName.value = button.label;
currentComponent.value = button.type; currentComponent.value = button.type;
dialogVisible.value = true; dialogVisible.value = true;
editable.value = button.editable ?? true;
}; };
const closeDialog = () => { const closeDialog = () => {
@@ -101,19 +105,21 @@ export default defineComponent({
// sharedText.value = `${textBefore}${value._t}${textAfter}`; // sharedText.value = `${textBefore}${value._t}${textAfter}`;
// } // }
if (value && value._t && (value._t as string).length > 0) {
canInput.value = editable.value;
}
emit('update:selectedObject', { sharedText: sharedText.value, ...value }); emit('update:selectedObject', { sharedText: sharedText.value, ...value });
dialogVisible.value = false; dialogVisible.value = false;
}; };
const clearSharedText = () => { const clearSharedText = () => {
sharedText.value = ''; sharedText.value = '';
canInput.value = true;
emit('update:selectedObject', {}); emit('update:selectedObject', {});
} }
const updateSharedText = (value) => { const updateSharedText = (value) => {
sharedText.value = value; sharedText.value = value;
emit('update:selectedObject', { ...props.selectedObject, sharedText: value }); emit('update:selectedObject', { ...props.selectedObject, sharedText: value });
console.log(props.selectedObject);
} }
return { return {
@@ -121,6 +127,7 @@ export default defineComponent({
dialogVisible, dialogVisible,
currentDialogName, currentDialogName,
currentComponent, currentComponent,
canInput,
openDialog, openDialog,
closeDialog, closeDialog,
handleSelect, handleSelect,