【发布时间】:2020-01-17 14:46:02
【问题描述】:
我希望能够在 Razor 页面应用程序中使用来自 Sencha ExtWebcomponents 的按钮和其他 UI 元素。例如,我希望 Index.cshtml 看起来像
@using WebMatrix.Data;
@{
Layout = "../Shared/Index.cshtml";
}
<script>
Ext.create('Ext.Container', {
fullscreen: true,
padding: 10,
items: {
xtype: 'button',
text: text,
handler: handler
}
});
</script>
我尝试将一些 JS 文件(见下文)捆绑在我认为很重要的模板 ExtWebcomponents 应用程序中,但我仍然收到类似 "SCRIPT5009: 'require' is not defined" 或 "SCRIPT5007: Unable to get property 'define' of undefined or null reference." 之类的错误
var scriptBundle = new ScriptBundle("~/Scripts/extwc_scripts/ExtWCBundle");
scriptBundle.Include("~/Scripts/extwc_scripts/extract-code.js");
scriptBundle.Include("~/Scripts/extwc_scripts/build/ext/ext.js");
然后我会在主布局中放置
@Scripts.Render("~/Scripts/extwc_scripts/ExtWCBundle")
您能告诉我正确的方法吗?
【问题讨论】:
标签: javascript c# asp.net extjs razor-pages