我正在尝试扩展一个 React 输入组件,该组件需要输入密码,并且在其旁边的元素或元素发生特定事件之后 - 它需要切换输入的类型(type =“text/password”)。
React 如何处理这个问题?
我将其作为我的组件的类:
import { React, Component } from 'lib'
export class PasswordInput extends Component {
constructor(props, context){
super(props, context)
const { type, validate, password } = this.props
if(context.onValidate && password) {
context.onValidate(password, validate)
}
if(context.showHide && password) {
context.onValidate(password, validate)
}
}
render() {
let inputType = 'password'
return (
<div className="form">
<label htmlFor="password">{ this.props.label }</label>
<input {...this.constructor.filterProps(this.props)} type={ inputType } />
{ this.props.touched && this.props.error && <div className="error">{ this.props.error }</div> }
<button …Run Code Online (Sandbox Code Playgroud) 我在这里堆满了gulp.src的问题,它只接受包含精确文件的字符串,例如
gulp.src('index.html')
Run Code Online (Sandbox Code Playgroud)
或字符串数组
gulp.src(['index.html', 'home.html', 'products.html'])
Run Code Online (Sandbox Code Playgroud)
但无法处理
gulp.src('./*.html')
Run Code Online (Sandbox Code Playgroud)
或gulp.src(['*。html','./**/*.html'])的目标。我总是会收到此错误,因为我在前两行中输入了一些不同的参数:
[15:48:46] Starting 'wiredep'...
[15:48:46] Finished 'wiredep' after 14 ms
events.js:160
throw er; // Unhandled 'error' event
^
TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.
Run Code Online (Sandbox Code Playgroud)
有人可以让我知道我在做什么错吗?