问题标签 [spfx]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
409 浏览

sharepoint-2016 - SP2016 - SP2016 FP2 上的 Spfx Webpart

我尝试构建一个针对 SP16 FP2 和 SP Online 的新 Webpart。
https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part

当我将包部署到我的 SP16 时,应用程序不会显示在我的其他站点上。

在我的 ULS 日志中,我只有以下错误:

任何想法我做错了什么?

0 投票
1 回答
25603 浏览

javascript - 属性更改时如何重新渲染反应组件

所以我有这个反应组件,它有一个下拉属性(SPFx),它有2个值,我需要当下拉列表被改变时,反应再次重新呈现,下拉列表定义了数据源,从中检索值。

Webpart.ts

组件.tsx

状态

道厂

JsonCustomerDao.ts

SharepointCustomerDao

第一次执行时,会为默认数据源呈现值,但是当属性更改时,UI 不会随着新值而更改。

我发现当下拉列表改变时我可以使用这个事件来设置新的 props 数据源值

但是视图没有重新渲染,我可以使用任何 react js 事件来重新渲染或在更改道具时重新设置状态吗?

0 投票
1 回答
52 浏览

sharepoint - How to Style Office Fabric Component with SharePont Framework module.scss

I am trying to style a VirtualizedComboBox being used in a SPFX web part. The problem is that if I use the combo box classes (ie. .ms-ComboBox-Input) as selectors within the web parts module.scss they get rendered out with the unique ID appended to them (ie. .ms-ComboBox-Input_4d3ebf8a), but the VirtualizedComboBox component does not append the ID to the classes it uses.

According to the MS docs nesting selectors in the scss should not append the ID to the nested selector, but that is not proving to be the case. When I nest it comes out as ".formGroup_4d3ebf8a .ms-ComboBox-Input_4d3ebf8a", when I need ".formGroup_4d3ebf8a .ms-ComboBox-Input". Any ideas?

0 投票
1 回答
406 浏览

sharepoint - SPFx 解决方案在清洁解决方案时出错

我用 SPFx 框架创建了一个 SharePoint 扩展。最初我运行了解决方案,它工作正常。但在第二次运行中,我想清理解决方案。所以我执行了gulp clean命令,但它失败了,每次似乎都会产生不同类型的错误。有时会出现错误gulp package-solution,有时会出现gulp build命令。以下是示例错误:

0 投票
1 回答
588 浏览

angular - 使用外部 Sharepoint 文件 URL 下载 Ionic 3 文件

我用 Sharepoint 创建了 Ionic 项目,

我有一个存储的 pdf、xls、doc 等文件在列表中,我有一个文件 URL 的实际路径,我在我的应用程序中创建带有下载选项的文档库,当我单击下载图标时,我必须下载那个特定的文件。

我努力了

文件传输插件

我无法实现请帮我解决这个问题。

这是我尝试过的代码。

文件传输方式:-

请给出一些下载文件的想法。有没有其他方法可以使用ionic3中的u​​rl下载文件?

0 投票
0 回答
297 浏览

listview - 将自定义命令的工具提示添加到列表项的上下文菜单

我们正在使用 SharePoint 框架扩展:命令集将自定义命令添加到上下文菜单和工具栏。

添加命令没有问题,而我们遇到了如何向自定义命令添加工具提示的问题。

1. 我们的 .manifest.json 文件内容是这样的:

2. 我们添加了扩展“BaseListViewCommandSet”并覆盖的类:onInit、onListViewUpdated、onExecute。

3. 班级

  • “BaseListViewCommandSet”扩展“BaseExtension”,有“上下文:ListViewCommandSetContext”
  • “ListViewCommandSetContext”具有“清单:ICommandSetExtensionManifest”
  • 这里是 'ICommandDefinition' 类型的 'items' 类型的项目:{ [itemId: string]: ICommandDefinition; };

而“ICommandDefinition”只有 4 个字段

(我无法在此处添加,例如描述或工具提示)

有人可以提示如何向自定义命令添加工具提示吗?

0 投票
1 回答
2080 浏览

javascript - SPFx - JavaScript 函数未触发

我在我的 web 部件的 render() 方法上组装了一个幻灯片组件,它显示得很好,但是激活幻灯片所需的 Javascript 操作“ShowSlide()”没有在内部触发$().ready()

我已经把电话放在里面

我已经没有想法了,我不知道是什么阻止了函数被触发,我添加了一个小按钮来手动调用这个函数,当按下按钮调用它时它可以工作,但不是预期的$().ready()

0 投票
1 回答
3386 浏览

reactjs - 在 SPFX 命令集中使用 SP.Modal 对话框

我的要求是使用列表中的命令集在模式对话框中打开SharePoint页面。我遵循了这个: MSDN tutorial to create command set

还有这个问题: 如何参考 sp.js

这是我的.ts文件代码

我收到以下错误:

找不到名称“SP”。在该行中 SP.UI.ModalDialog.showModalDialog(options)

请提供一些见解,因为我是 SPFX 的初学者

0 投票
2 回答
241 浏览

sharepoint - 如何创建 SPFX Web 部件?直到部署和调试的步骤

我想了解基础知识并使用 SPFx(SharePoit 框架)创建 webpart,我需要完成的步骤,直到在线 sharePoint 中的部署和调试。

0 投票
0 回答
204 浏览

azure - SPFX 1.41 AAD Http Client web part to call secure Azure App Service does not work on Safari

We created a Azure AD protected App Service and we can successfully call the service from a SharePoint web part based on the SPFX 1.4.1 framework. Most browsers work, like IE (11 and Edge), Firefox and Chrome (the recent ones).

We chose to use the AadHTTPClient as described here:https://docs.microsoft.com/en-us/sharepoint/dev/spfx/use-aadhttpclient-enterpriseapi

Unfortunately, On Safari, we see a problem. The error that Safari shows is: [Error] The source list for Content Security Policy directive 'script-src' contains an invalid source: ''strict-dynamic''. It will be ignored. (x4)

Any idea what is going on? And are there plans to fix this in the SPFX package? Or is this a Safari-related problem?

Thank you!