From 3f449816ed4e8d494d1ef7023af50f1070fe81f9 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 22 Apr 2026 15:55:45 +0800 Subject: [PATCH] Fix List component constructor: ensure opts.options exists before accessing width/height properties --- wwwroot/list-component.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/wwwroot/list-component.js b/wwwroot/list-component.js index 4b51f3f..1265b85 100644 --- a/wwwroot/list-component.js +++ b/wwwroot/list-component.js @@ -3,17 +3,22 @@ bricks.List = class extends bricks.VBox { constructor(opts) { + // Ensure opts has options property + if (!opts) opts = {}; + if (!opts.options) opts.options = {}; + + // Set default dimensions if not provided + if (!opts.options.width) opts.options.width = '100%'; + if (!opts.options.height) opts.options.height = '100%'; + super(opts); + this.data_url = opts.data_url || null; this.items = opts.items || []; this.item_template_url = opts.item_template_url || null; // URL to the item template .ui file this.itemHeight = opts.itemHeight || 50; this._loading = false; - // Set default dimensions - if (!this.options.width) this.options.width = '100%'; - if (!this.options.height) this.options.height = '100%'; - // Load data if provided if (this.data_url) { this.loadData();