verNameのラッピング・オブジェクト

This commit is contained in:
Mouriya
2024-05-17 14:41:15 +09:00
parent 64d2cadd82
commit 61ac281134
2 changed files with 37 additions and 17 deletions

View File

@@ -205,7 +205,7 @@ export default defineComponent({
*/
const varName =(node:IActionNode)=>{
const prop = node.actionProps.find((prop) => prop.props.name === "verName");
return prop?.props.modelValue;
return prop?.props.modelValue.name;
};
const copyFlow=()=>{
context.emit('copyFlow', props.actionNode);

View File

@@ -1,10 +1,7 @@
<template>
<div v-bind="$attrs">
<q-input :label="displayName" v-model="inputValue" label-color="primary"
:placeholder="placeholder" stack-label
:rules="rulesExp"
:maxlength="maxLength"
>
<q-input :label="displayName" v-model="inputValue" label-color="primary" :placeholder="placeholder" stack-label
:rules="rulesExp" :maxlength="maxLength">
<template v-slot:append v-if="hint !== ''">
<q-icon name="help" size="22px" color="blue-8">
<q-tooltip class="bg-yellow-2 text-black shadow-4" anchor="bottom right">
@@ -18,7 +15,7 @@
<script lang="ts">
import { kMaxLength } from 'buffer';
import { defineComponent, ref, watchEffect } from 'vue';
import { defineComponent, ref, watchEffect, computed } from 'vue';
export default defineComponent({
name: 'InputText',
@@ -40,27 +37,50 @@ export default defineComponent({
type: String,
default: '',
},
maxLength:{
maxLength: {
type: Number,
default:undefined
default: undefined
},
//例:[val=>!!val ||'入力してください']
rules:{
type:String,
default:undefined
rules: {
type: String,
default: undefined
},
modelValue: {
type: String,
// type: Any,
default: '',
},
},
setup(props, { emit }) {
const inputValue = ref(props.modelValue);
const rulesExp = props.rules===undefined?null : eval(props.rules);
watchEffect(() => {
emit('update:modelValue', inputValue.value);
const inputValue = computed({
get: () => {
if (props.modelValue !== null && typeof props.modelValue === 'object' && 'name' in props.modelValue) {
return props.modelValue.name;
} else {
return props.modelValue;
}
},
set: (val) => {
if (props.name === 'verName') {
// return props.modelValue.name;
emit('update:modelValue', { name: val });
} else {
emit('update:modelValue', val);
}
},
});
// const inputValue = ref(props.modelValue);
const rulesExp = props.rules === undefined ? null : eval(props.rules);
// const finalValue = computed(() => {
// return props.name !== 'verName' ? inputValue.value : {
// name: inputValue.value,
// };
// });
// watchEffect(() => {
// emit('update:modelValue', finalValue);
// });
return {
inputValue,