mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
fix(editor): 数据源字段选择器初始化状态
This commit is contained in:
parent
0e0f50187e
commit
05527a41a1
@ -17,7 +17,6 @@
|
|||||||
<TMagicButton
|
<TMagicButton
|
||||||
v-if="(showDataSourceFieldSelect || !config.fieldConfig) && selectedDataSourceId"
|
v-if="(showDataSourceFieldSelect || !config.fieldConfig) && selectedDataSourceId"
|
||||||
style="margin-left: 5px"
|
style="margin-left: 5px"
|
||||||
link
|
|
||||||
:size="size"
|
:size="size"
|
||||||
@click="editHandler(selectedDataSourceId)"
|
@click="editHandler(selectedDataSourceId)"
|
||||||
><MIcon :icon="Edit"></MIcon
|
><MIcon :icon="Edit"></MIcon
|
||||||
@ -25,7 +24,6 @@
|
|||||||
<TMagicButton
|
<TMagicButton
|
||||||
v-if="config.fieldConfig"
|
v-if="config.fieldConfig"
|
||||||
style="margin-left: 5px"
|
style="margin-left: 5px"
|
||||||
link
|
|
||||||
:type="showDataSourceFieldSelect ? 'primary' : 'default'"
|
:type="showDataSourceFieldSelect ? 'primary' : 'default'"
|
||||||
:size="size"
|
:size="size"
|
||||||
@click="showDataSourceFieldSelect = !showDataSourceFieldSelect"
|
@click="showDataSourceFieldSelect = !showDataSourceFieldSelect"
|
||||||
@ -43,7 +41,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, inject, onMounted, ref, resolveComponent } from 'vue';
|
import { computed, inject, ref, resolveComponent, watch } from 'vue';
|
||||||
import { Coin, Edit } from '@element-plus/icons-vue';
|
import { Coin, Edit } from '@element-plus/icons-vue';
|
||||||
|
|
||||||
import { TMagicButton } from '@tmagic/design';
|
import { TMagicButton } from '@tmagic/design';
|
||||||
@ -137,16 +135,23 @@ const cascaderConfig = computed<CascaderConfig>(() => {
|
|||||||
|
|
||||||
const showDataSourceFieldSelect = ref(false);
|
const showDataSourceFieldSelect = ref(false);
|
||||||
|
|
||||||
onMounted(() => {
|
watch(
|
||||||
const value = props.model[props.name];
|
() => props.model[props.name],
|
||||||
if (
|
(value) => {
|
||||||
Array.isArray(value) &&
|
if (
|
||||||
typeof value[0] === 'string' &&
|
Array.isArray(value) &&
|
||||||
value[0].startsWith(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX)
|
typeof value[0] === 'string' &&
|
||||||
) {
|
value[0].startsWith(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX)
|
||||||
showDataSourceFieldSelect.value = true;
|
) {
|
||||||
}
|
showDataSourceFieldSelect.value = true;
|
||||||
});
|
} else {
|
||||||
|
showDataSourceFieldSelect.value = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const mForm = inject<FormState | undefined>('mForm');
|
const mForm = inject<FormState | undefined>('mForm');
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user