This commit is contained in:
yumoqing 2024-05-16 17:53:31 +08:00
parent 3b5663e59a
commit 0c6000432b
5 changed files with 6 additions and 12 deletions

View File

@ -108,7 +108,7 @@ bricks.widgetBuild = async function(desc, widget, data){
var klassname = desc.widgettype; var klassname = desc.widgettype;
var base_url = widget.baseURI; var base_url = widget.baseURI;
while (klassname == 'urlwidget'){ while (klassname == 'urlwidget'){
let url = absurl(desc.options.url, widget); let url = bricks.absurl(desc.options.url, widget);
base_url = url; base_url = url;
let method = desc.options.method || 'GET'; let method = desc.options.method || 'GET';
let opts = desc.options.params || {}; let opts = desc.options.params || {};
@ -476,7 +476,7 @@ bricks.App = class extends bricks.Layout {
} }
async build(){ async build(){
var opts = structuredClone(this.opts.widget); var opts = structuredClone(this.opts.widget);
var w = await (bricks.widgetBuild(opts, bricks.Body)); var w = await bricks.widgetBuild(opts, bricks.Body);
if (!w){ if (!w){
bricks.debug('w=', w, 'Body=', bricks.Body, 'Factory=', bricks.Factory) bricks.debug('w=', w, 'Body=', bricks.Body, 'Factory=', bricks.Factory)
} }
@ -484,7 +484,7 @@ bricks.App = class extends bricks.Layout {
} }
async run(){ async run(){
await (this.change_language(this)); await (this.change_language(this));
var w = await (this.build()); var w = await this.build();
this.root = w; this.root = w;
if (!w){ if (!w){
bricks.debug('w=', w, 'Body=', bricks.Body, 'Factory=', bricks.Factory) bricks.debug('w=', w, 'Body=', bricks.Body, 'Factory=', bricks.Factory)

View File

@ -173,7 +173,7 @@ bricks.DataGrid = class extends bricks.VBox {
this.loader = new bricks.BufferedDataLoader(this, { this.loader = new bricks.BufferedDataLoader(this, {
pagerows: 80, pagerows: 80,
buffer_pages: 5, buffer_pages: 5,
url: absurl(this.dataurl, this), url: bricks.absurl(this.dataurl, this),
method: this.method, method: this.method,
params: this.params params: this.params
}) })

View File

@ -81,7 +81,7 @@ bricks.MarkdownViewer = class extends bricks.VBox {
constructor(options){ constructor(options){
super(options); super(options);
this.back_stack = []; this.back_stack = [];
this.md_url = this.absurl(this.opts.md_url); this.md_url = bricks.absurl(this.opts.md_url);
if (this.opts.navigator){ if (this.opts.navigator){
this.createBackButton(); this.createBackButton();
} }

View File

@ -240,7 +240,7 @@ Array.prototype.remove = function(item){
return this; return this;
} }
var absurl = function(url, widget){ bricks.absurl = function(url, widget){
if (url.startsWith('http://') || url.startsWith('https://')){ if (url.startsWith('http://') || url.startsWith('https://')){
return url; return url;
} }

View File

@ -194,12 +194,6 @@ bricks.JsWidget = class {
set_baseURI(url){ set_baseURI(url){
this.baseURI = url; this.baseURI = url;
} }
absurl(url){
if (this.baseURI){
return absurl(url, this);
}
return url
}
show(){ show(){
this.dom_element.style.display = ''; this.dom_element.style.display = '';
} }