GooglePicker 的 onChange() 函数未在 React 程序中调用
GooglePicker's onChange() function is not being called in React programme
这是我的 GooglePicker
<GooglePicker clientId={'ClientID'}
developerKey={'API Key'}
scope={['https://www.googleapis.com/auth/drive.readonly']}
onChange={this.onChange}
multiselect={true}
navHidden={true}
authImmediate={false}
mimeTypes={['image/png', 'image/jpeg', 'image/jpg']}
viewId={'DOCS_IMAGES'}>
<button type="button" id="pick">Pick File</button>
</GooglePicker>
这是我的 onchange 函数
onChange() {
console.log("Change is logged here");
}
我能够显示选择器按钮和 select 来自 google 驱动器的文件。但是没有调用 onChange 函数。请让我知道代码中的缺陷。
尝试发送您的 onChange
函数,例如 arrow function
:
<GooglePicker clientId={'ClientID'}
developerKey={'API Key'}
scope={['https://www.googleapis.com/auth/drive.readonly']}
onChange={(data) => this.onChange(data)}
multiselect={true}
navHidden={true}
authImmediate={false}
mimeTypes={['image/png', 'image/jpeg', 'image/jpg']}
viewId={'DOCS_IMAGES'}>
<button type="button" id="pick">Pick File</button>
</GooglePicker>
这是我的 GooglePicker
<GooglePicker clientId={'ClientID'}
developerKey={'API Key'}
scope={['https://www.googleapis.com/auth/drive.readonly']}
onChange={this.onChange}
multiselect={true}
navHidden={true}
authImmediate={false}
mimeTypes={['image/png', 'image/jpeg', 'image/jpg']}
viewId={'DOCS_IMAGES'}>
<button type="button" id="pick">Pick File</button>
</GooglePicker>
这是我的 onchange 函数
onChange() {
console.log("Change is logged here");
}
我能够显示选择器按钮和 select 来自 google 驱动器的文件。但是没有调用 onChange 函数。请让我知道代码中的缺陷。
尝试发送您的 onChange
函数,例如 arrow function
:
<GooglePicker clientId={'ClientID'}
developerKey={'API Key'}
scope={['https://www.googleapis.com/auth/drive.readonly']}
onChange={(data) => this.onChange(data)}
multiselect={true}
navHidden={true}
authImmediate={false}
mimeTypes={['image/png', 'image/jpeg', 'image/jpg']}
viewId={'DOCS_IMAGES'}>
<button type="button" id="pick">Pick File</button>
</GooglePicker>