2

我们正在尝试使用 office ui fabric react 构建一个带有 asp.net MVC 的示例应用程序。按照此处提到的 node js 命令提示符执行以下步骤。按照这些步骤,我可以让正常的反应样本工作。我尝试在 index.tsx 文件中添加下面给出的结构 UI 标签代码,然后运行应用程序,但结构反应标签组件没有在浏览器中呈现。index.tsx 代码:

/* tslint:disable:no-unused-variable */
import * as React from 'react';
/* tslint:enable:no-unused-variable */
import { Label } from 'office-ui-fabric-react/lib/Label';
export const LabelBasicExample = () => (
    <div>
    <Label>I'm a Label</Label>
    <Label disabled={ true }>I'm a disabled Label</Label>
    <Label required={ true }>I'm a required Label</Label>
    </div>
);

添加此代码后,从 nodejs 命令提示符运行 webpack,然后尝试浏览具有以下代码的 index.html。但是看不到反应组件被渲染,我也没有得到任何错误。

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React!</title>
</head>
<body>
<div id="example"></div>
<!-- Dependencies -->
<script src="./node_modules/react/umd/react.development.js"></script>
<script src="./node_modules/react-dom/umd/react-dom.development.js"></script>

<!-- Main -->
<script src="./dist/bundle.js"></script>
</body>
</html>

有人可以在这里提供帮助,是否有我在这里遗漏的任何其他步骤或指导我让织物反应组件与 asp.net 一起使用。

谢谢

4

0 回答 0