1
0
mirror of synced 2026-05-20 17:28:42 +08:00

feat(vue-components): 添加页面片容器id prop

This commit is contained in:
roymondchen
2025-07-15 15:31:51 +08:00
parent 1736d495fd
commit a43825caa2
30 changed files with 285 additions and 1284 deletions

View File

@@ -1,5 +1,5 @@
{
"version": "0.1.0",
"version": "0.2.0",
"name": "@tmagic/vue-iterator-container",
"type": "module",
"main": "src/index.ts",

View File

@@ -13,9 +13,8 @@
</template>
<script lang="ts">
import { computed, defineComponent, inject, type PropType, watch } from 'vue-demi';
import { computed, defineComponent, type PropType, watch } from 'vue-demi';
import type TMagicApp from '@tmagic/core';
import {
COMMON_EVENT_PREFIX,
type Id,
@@ -23,7 +22,7 @@ import {
type MIteratorContainer,
type MNode,
} from '@tmagic/core';
import { registerNodeHooks, useNode } from '@tmagic/vue-runtime-help';
import { registerNodeHooks, useApp } from '@tmagic/vue-runtime-help';
import IteratorItem from './IteratorItem.vue';
@@ -53,6 +52,7 @@ export default defineComponent({
iteratorIndex: Array as PropType<number[]>,
iteratorContainerId: Array as PropType<Id[]>,
containerIndex: Number,
pageFragmentContainerId: [String, Number] as PropType<Id>,
model: {
type: Object,
default: () => ({}),
@@ -60,8 +60,7 @@ export default defineComponent({
},
setup(props) {
const app = inject<TMagicApp>('app');
const node = useNode(props, app);
const { app, node } = useApp(props);
registerNodeHooks(node);
const configs = computed<IteratorItemSchema[]>(() => {
@@ -104,11 +103,11 @@ export default defineComponent({
return;
}
const iteratorContainerNode = app?.getNode<TMagicIteratorContainer>(
props.config.id,
props.iteratorContainerId,
props.iteratorIndex,
);
const iteratorContainerNode = app?.getNode<TMagicIteratorContainer>(props.config.id, {
iteratorContainerId: props.iteratorContainerId,
iteratorIndex: props.iteratorIndex,
pageFragmentContainerId: props.pageFragmentContainerId,
});
if (!iteratorContainerNode) {
return;

View File

@@ -13,7 +13,7 @@
import { defineComponent, inject, type PropType } from 'vue-demi';
import type TMagicApp from '@tmagic/core';
import type { Id } from '@tmagic/core';
import { type Id } from '@tmagic/core';
import { useComponent, useComponentStatus } from '@tmagic/vue-runtime-help';
import { IteratorItemSchema } from './type';