mirror of
https://github.com/smartxworks/sunmao-ui.git
synced 2025-02-23 17:49:49 +08:00
fix(module): fix $slot doesn't work in module
This commit is contained in:
parent
3d2a090530
commit
38fc3bb9b1
@ -14,7 +14,7 @@
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"dev": "vite --port 8080",
|
||||
"dev": "vite --port 7000",
|
||||
"build": "tsup && npm run visualize",
|
||||
"typings": "tsc --emitDeclarationOnly",
|
||||
"test": "jest",
|
||||
@ -41,9 +41,9 @@
|
||||
"@sunmao-ui/arco-lib": "^0.4.0",
|
||||
"@sunmao-ui/chakra-ui-lib": "^0.6.0",
|
||||
"@sunmao-ui/core": "^0.8.0",
|
||||
"@sunmao-ui/editor-sdk": "^0.5.0",
|
||||
"@sunmao-ui/runtime": "^0.9.0",
|
||||
"@sunmao-ui/shared": "^0.4.0",
|
||||
"@sunmao-ui/editor-sdk": "^0.4.0",
|
||||
"@sunmao-ui/runtime": "^0.8.0",
|
||||
"@sunmao-ui/shared": "^0.3.0",
|
||||
"acorn": "^8.7.0",
|
||||
"acorn-loose": "^8.3.0",
|
||||
"acorn-walk": "^8.2.0",
|
||||
|
@ -296,7 +296,12 @@ function getRelations(component: IComponentModel, components: IComponentModel[])
|
||||
if (field.isDynamic) {
|
||||
const usedIds = Object.keys(field.refComponentInfos);
|
||||
usedIds.forEach(usedId => {
|
||||
if (!ids.includes(usedId)) {
|
||||
// 排除掉全局变量和sunmao关键字
|
||||
if (
|
||||
!ids.includes(usedId) &&
|
||||
!(usedId in window) &&
|
||||
!ExpressionKeywords.includes(usedId)
|
||||
) {
|
||||
expressionRelations.push({
|
||||
componentId: usedId,
|
||||
exp: field.rawValue,
|
||||
|
@ -169,18 +169,10 @@ export class StateManager {
|
||||
options: EvalOptions = {}
|
||||
): EvaledResult<T> {
|
||||
const store = this.slotStore;
|
||||
const redirector = new Proxy(
|
||||
{},
|
||||
{
|
||||
get(_, prop) {
|
||||
return options.slotKey ? store[options.slotKey][prop] : undefined;
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
options.scopeObject = {
|
||||
...options.scopeObject,
|
||||
$slot: redirector,
|
||||
$slot: options.slotKey ? store[options.slotKey] : undefined,
|
||||
};
|
||||
// just eval
|
||||
if (typeof value !== 'string') {
|
||||
@ -208,17 +200,9 @@ export class StateManager {
|
||||
: PropsAfterEvaled<Exclude<T, string>>;
|
||||
|
||||
const store = this.slotStore;
|
||||
const redirector = new Proxy(
|
||||
{},
|
||||
{
|
||||
get(_, prop) {
|
||||
return options.slotKey ? store[options.slotKey][prop] : undefined;
|
||||
},
|
||||
}
|
||||
);
|
||||
options.scopeObject = {
|
||||
...options.scopeObject,
|
||||
$slot: redirector,
|
||||
$slot: options.slotKey ? store[options.slotKey] : undefined,
|
||||
};
|
||||
// watch change
|
||||
if (value && typeof value === 'object') {
|
||||
|
Loading…
Reference in New Issue
Block a user