mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-09 23:49:27 +08:00
Merge branch 'next' into develop
This commit is contained in:
commit
d82e0a69b0
@ -267,7 +267,7 @@ export class Application {
|
|||||||
return this.getPublicPath() + pathname.replace(/^\//g, '');
|
return this.getPublicPath() + pathname.replace(/^\//g, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
getFullUrl(pathname: string) {
|
getHref(pathname: string) {
|
||||||
const name = this.name;
|
const name = this.name;
|
||||||
if (name && name !== 'main') {
|
if (name && name !== 'main') {
|
||||||
return this.getPublicPath() + 'apps/' + name + '/' + pathname.replace(/^\//g, '');
|
return this.getPublicPath() + 'apps/' + name + '/' + pathname.replace(/^\//g, '');
|
||||||
|
@ -85,29 +85,29 @@ describe('Application', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getFullUrl', () => {
|
describe('getHref', () => {
|
||||||
it('default', () => {
|
it('default', () => {
|
||||||
const app = new Application({});
|
const app = new Application({});
|
||||||
expect(app.getFullUrl('test')).toBe('/test');
|
expect(app.getHref('test')).toBe('/test');
|
||||||
expect(app.getFullUrl('/test')).toBe('/test');
|
expect(app.getHref('/test')).toBe('/test');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('custom', () => {
|
it('custom', () => {
|
||||||
const app = new Application({ publicPath: '/nocobase' });
|
const app = new Application({ publicPath: '/nocobase' });
|
||||||
expect(app.getFullUrl('/test')).toBe('/nocobase/test');
|
expect(app.getHref('/test')).toBe('/nocobase/test');
|
||||||
expect(app.getFullUrl('test')).toBe('/nocobase/test');
|
expect(app.getHref('test')).toBe('/nocobase/test');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sub app', () => {
|
it('sub app', () => {
|
||||||
const app = new Application({ name: 'sub1' });
|
const app = new Application({ name: 'sub1' });
|
||||||
expect(app.getFullUrl('test')).toBe('/apps/sub1/test');
|
expect(app.getHref('test')).toBe('/apps/sub1/test');
|
||||||
expect(app.getFullUrl('/test')).toBe('/apps/sub1/test');
|
expect(app.getHref('/test')).toBe('/apps/sub1/test');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sub app', () => {
|
it('sub app', () => {
|
||||||
const app = new Application({ name: 'sub1', publicPath: '/nocobase/' });
|
const app = new Application({ name: 'sub1', publicPath: '/nocobase/' });
|
||||||
expect(app.getFullUrl('test')).toBe('/nocobase/apps/sub1/test');
|
expect(app.getHref('test')).toBe('/nocobase/apps/sub1/test');
|
||||||
expect(app.getFullUrl('/test')).toBe('/nocobase/apps/sub1/test');
|
expect(app.getHref('/test')).toBe('/nocobase/apps/sub1/test');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ export const DesktopModeHeader: FC = () => {
|
|||||||
}
|
}
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
<Button style={{ color: 'white' }} href={app.getFullUrl('/admin')}>
|
<Button style={{ color: 'white' }} href={app.getHref('/admin')}>
|
||||||
{t('Back')}
|
{t('Back')}
|
||||||
</Button>
|
</Button>
|
||||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user