我无法使它工作.弹出调用代码是
presentPopover(myEvent){
//alert('invoke popup')
let popover = this.popoverCtrl.create(PopoverPage, this.data);
popover.present(
{
ev: myEvent
}
);
}
Run Code Online (Sandbox Code Playgroud)
我目前需要访问的部分是:
export class PopoverPage{
constructor(public viewCtrl: ViewController) {
// alert('in the popup')
//alert(this.data)
}
Run Code Online (Sandbox Code Playgroud)
那么如何将数据放在popupover页面组件中呢?
我正在ReactJs中创建一个基本应用程序,以实现基本的HTML5拖放功能。我面临的问题是,我的onDragStart事件没有将事件对象传递给处理程序方法。我已经参考了HTML5 Drag and Drop的文档,其中展示了如何将事件对象传递给处理程序。
这是我的代码,用于为onDragStart事件实现事件处理程序。
//handler method
dragStartHandler(event) {
console.log(event); // undefined
}
render() {
return (
<div draggable="true"
onDragStart={this.dragStartHandler(event)}></div>
)
}
Run Code Online (Sandbox Code Playgroud)
正在调用处理程序,但没有事件对象。我的日程安排是捕获事件对象,以便我可以使用DataTransfer接口进一步将数据绑定到事件。
请帮助我了解行为。
谢谢!
更新资料
不将事件传递给dragStartHandler方法实际上是将事件传递给处理程序方法。与HTML5 DND文档中提到的方法不同,它是React绑定方法的唯一方式,似乎不适用于react。我在处理程序中得到的事件是根据html规范包装的原始Drag Event版本。这种行为使我感到困惑,因为它给出了一些Proxy对象,可能是由react创建的。
解决方案:尽管Proxy对象具有原始Drag事件的所有方法,但我后来才意识到。因此,您可以像以前一样将新的Proxy事件对象用作本机html元素,并具有所有以前的行为。
我想像这里一样显示图表https://www.chartjs.org/samples/latest/scales/time/financial.html
我编写了以下代码来显示图表,但是当我运行代码时,出现以下错误:
Chart.min.js?ver=1.0.0:7 未捕获的错误:此方法未实现:要么找不到适配器,要么提供了不完整的集成。在 ri.oi (Chart.min.js?ver=1.0.0:7) 在 i.update (Chart.min.js?ver=1.0.0:7) 在 Chart.min.js?ver=1.0.0 :7 at Object.each (Chart.min.js?ver=1.0.0:7) at Object.update (Chart.min.js?ver=1.0.0:7) at ni.updateLayout (Chart.min.js ?ver=1.0.0:7) at ni.update (Chart.min.js?ver=1.0.0:7) at ni.construct (Chart.min.js?ver=1.0.0:7) at new ni (Chart.min.js?ver=1.0.0:7) 在 initializeCustomerFlowChart (reports.js?ver=1.0.0:83)
/**
* JS Code for the admin-panel/contact/reports.
*
* It handles initializtion of the customer flow chart.
*/
'use strict';
jQuery(document).ready(function() {
console.log('admin-panel/contact/reports');
// Initialize the custome flow chart.
initializeCustomerFlowChart();
});
function initializeCustomerFlowChart() {
var dataSet = [];
for(var i = 0 ; i …Run Code Online (Sandbox Code Playgroud)我想对每次从数据库中提取的动态javascript数组进行排序.条件是我想根据标准预定义数组中以特定顺序存储的值对其进行排序.
让我说我的Dyanamic数组就像:
var dbArray = ['Apple','Banana','Mango','Apple','Mango','Mango','Apple'];
Run Code Online (Sandbox Code Playgroud)
并假设我必须对上面的数组进行排序的标准数组就像
var stdArray = ['Mango','Apple','Banana','Grapes'];
Run Code Online (Sandbox Code Playgroud)
因此在对dbArray进行排序后,我的结果数组应如下所示:
var resultArray = ['Mango','Mango','Mango','Apple','Apple','Apple','Banana'];
Run Code Online (Sandbox Code Playgroud)
因为它被排序,保持stdArray作为排序标准,无论按字母顺序排列还是任何其他可用的标准排序顺序,它都可以是任何顺序,纯自定义排序.