U9公开出来的代码大概率是同一个来源,文字都是一字不差,其中错误也是一样。来源是官网上的Demo吧。错误造成用户的学习进度缓慢,甚至有放弃的念头。
借助于GitHub Copilot工具,问题迎刃而解。知道了原因是什么,记录一下,以免忘掉又要花时间去分析。

正确的是
//if (webButton != null && webButton.Action == "BtnOutput")
//{
var btnName=sender.GetType().GetProperty("Text")?.GetValue(sender, null)?.ToString();//拿到按钮上的文本
UFSoft.UBF.UI.AtlasHelper.RegisterAtlasStartupScript(
this.part.Page, //缺少一个页面对象
this.part.Page.GetType(),
"JavaScriptExecQueue",
$"alert('单击的按钮是 {btnName}');",
true);
//}
效果是这样的。
