feat(editor,ui): 页面片下拉选择框支持点击跳转编辑,修改页面片组件initvalue

This commit is contained in:
parisma 2023-12-20 11:40:08 +08:00 committed by roymondchen
parent 2dcef449bf
commit 2dc810a9fd
6 changed files with 29 additions and 6 deletions

View File

@ -9,16 +9,20 @@
:size="size" :size="size"
@change="changeHandler" @change="changeHandler"
></m-form-container> ></m-form-container>
<!-- 编辑按钮 -->
<Icon v-if="model[name]" class="icon" :icon="Edit" @click="editPageFragment(model[name])"></Icon>
</div> </div>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, inject } from 'vue'; import { computed, inject } from 'vue';
import { Edit } from '@element-plus/icons-vue';
import { FieldProps } from '@tmagic/form'; import { FieldProps } from '@tmagic/form';
import { NodeType } from '@tmagic/schema'; import { Id, NodeType } from '@tmagic/schema';
import Icon from '@editor/components/Icon.vue';
import type { PageFragmentSelectConfig, Services } from '@editor/type'; import type { PageFragmentSelectConfig, Services } from '@editor/type';
defineOptions({ defineOptions({
@ -41,8 +45,8 @@ const selectConfig = {
options: () => { options: () => {
if (pageList.value) { if (pageList.value) {
return pageList.value.map((item) => ({ return pageList.value.map((item) => ({
text: `${item.name}${item.id}`, text: `${item.devconfig?.tabName || item.title || item.name}${item.id}`,
label: `${item.name}${item.id}`, label: `${item.devconfig?.tabName || item.title || item.name}${item.id}`,
value: item.id, value: item.id,
})); }));
} }
@ -52,4 +56,8 @@ const selectConfig = {
const changeHandler = async () => { const changeHandler = async () => {
emit('change', props.model[props.name]); emit('change', props.model[props.name]);
}; };
const editPageFragment = (id: Id) => {
services?.editorService.select(id);
};
</script> </script>

View File

@ -0,0 +1,14 @@
.m-fields-page-fragment-select {
width: 100%;
.page-fragment-select-container {
width: 100%;
display: flex;
align-items: center;
.select {
flex: 1;
}
.icon {
margin-left: 10px;
}
}
}

View File

@ -24,3 +24,4 @@
@import "./floatbox.scss"; @import "./floatbox.scss";
@import "./tree.scss"; @import "./tree.scss";
@import "./floating-box.scss"; @import "./floating-box.scss";
@import "./page-fragment-select.scss";

View File

@ -20,6 +20,6 @@ export default {
items: [], items: [],
style: { style: {
width: '375', width: '375',
height: '950', height: '817',
}, },
}; };

View File

@ -20,6 +20,6 @@ export default {
items: [], items: [],
style: { style: {
width: '375', width: '375',
height: '950', height: '817',
}, },
}; };

View File

@ -20,6 +20,6 @@ export default {
items: [], items: [],
style: { style: {
width: '375', width: '375',
height: '950', height: '817',
}, },
}; };