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

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;
color: string;
type: string;
editable: boolean;
};
export default defineComponent({
@@ -55,10 +56,10 @@ export default defineComponent({
ShowDialog
},
props: {
canInput: {
type: Boolean,
default: false
},
// canInput: {
// type: Boolean,
// default: false
// },
appId: {
type: String,
},
@@ -79,11 +80,14 @@ export default defineComponent({
const currentComponent = ref('FieldAdd');
const sharedText = ref(props.selectedObject?.sharedText ?? '');
const inputRef = ref();
const canInput = ref(true);
const editable = ref(false);
const openDialog = (button: ButtonConfig) => {
currentDialogName.value = button.label;
currentComponent.value = button.type;
dialogVisible.value = true;
editable.value = button.editable ?? true;
};
const closeDialog = () => {
@@ -100,20 +104,22 @@ export default defineComponent({
// const textAfter = sharedText.value.substring(cursorPosition);
// 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 });
dialogVisible.value = false;
};
const clearSharedText = () => {
sharedText.value = '';
canInput.value = true;
emit('update:selectedObject', {});
}
const updateSharedText = (value) => {
sharedText.value = value;
emit('update:selectedObject', { ...props.selectedObject, sharedText: value });
console.log(props.selectedObject);
}
return {
@@ -121,6 +127,7 @@ export default defineComponent({
dialogVisible,
currentDialogName,
currentComponent,
canInput,
openDialog,
closeDialog,
handleSelect,