我正在为SharePoint 2013页面构建Reactjs组件。在SharePoint JSOM中,我可以通过调用GetCurrentCtx()来获取当前上下文。我想在我的ReactJs组件中调用此方法,但我不知道该怎么做:
import React from 'react';
class TestComponent extends React.Component {
constructor(props){
super(props);
this.state = {likesCount:0, listTitle:''};
this.onLike = this.onLink.bind(this);
}
onLink(e){
e.preventDefault();
var ctx = GetCurrentCtx(); //<- this line doesn't work.
this.setState({listTitle:ctx.ListTitle});
return false;
}
render(){
return (
<div>
<div>List Title: {this.state.listTitle}</div>
<div><button onClick={this.onClick}>Get List Title</button></div>
</div>
);
}
}
export default TestComponent;
有什么想法吗?
答案 0 :(得分:0)
只需method
个文件/组件,即'charset' => 'utf8',
'driver_options' => array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''
)
答案 1 :(得分:0)
类似的东西:
import { GetCurrentCtx } from './filepath_for_this_function_export'