Skip to content

Commit

Permalink
Merge pull request baidu#9630 from hsm-lv/fix-scope
Browse files Browse the repository at this point in the history
fix:scope命中多目标兼容空格情况
  • Loading branch information
hsm-lv committed Feb 21, 2024
2 parents fe47227 + 296c950 commit 7e03085
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/amis-core/__tests__/scoped.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {makeEnv} from './helper';
test('Scoped splitTarget', async () => {
expect(splitTarget('abc')).toEqual(['abc']);
expect(splitTarget('a,b,c')).toEqual(['a', 'b', 'c']);
expect(splitTarget('a, b, c ')).toEqual(['a', 'b', 'c']);
expect(splitTarget('a?x=1&y=2,b,c')).toEqual(['a?x=1&y=2', 'b', 'c']);
expect(splitTarget('a?x=${[a, b]},b,c')).toEqual(['a?x=${[a, b]}', 'b', 'c']);
expect(splitTarget('a?x=${[a, b]}')).toEqual(['a?x=${[a, b]}']);
Expand Down
2 changes: 1 addition & 1 deletion packages/amis-core/src/Scoped.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function splitTarget(target: string): Array<string> {
let parts: Array<string> = [];

pos.reduceRight((arr: Array<string>, index) => {
arr.unshift(target.slice(index + 1));
arr.unshift(target.slice(index + 1)?.trim());
target = target.slice(0, index);
return arr;
}, parts);
Expand Down

0 comments on commit 7e03085

Please sign in to comment.