reactjs - 标识符“eye”已被声明
问题描述
我正在使用 ionic+react 开发应用程序。在登录页面密码字段中使用眼睛和眼睛离开图标时,它已经被声明错误。破折号“视线”似乎有问题。如果包含破折号的任何其他图标,同样的问题。
./src/pages/Login.tsx
SyntaxError: D:\project\src\pages\Login.tsx: Identifier 'eye' has already been declared (12:28)
10 | import React, { createContext, useState, useEffect } from "react";
11 | import { IonGrid, IonRow, IonCol } from "@ionic/react";
> 12 | import { personCircle, eye, eye-off } from "ionicons/icons";
| ^
13 | import { useHistory } from "react-router-dom";
14 | import {
15 | IonItem,
代码页
<IonRow>
<IonCol>
<IonItem>
<IonLabel position="floating"> Password</IonLabel>
<IonInput
type={passwordShown ? "text" : "password"}
value={password}
onIonChange={(e) => setPassword(e.detail.value!)}
></IonInput>
<IonIcon icon={passwordShown ? eye : eye-off} onClick={togglePasswordVisiblity} slot="end"></IonIcon>
</IonItem>
</IonCol>
</IonRow>
请建议
解决方案
推荐阅读
- android - 通知状态栏图标不会变为白色
- swift - CloudKit 自动后台备份
- python - django 视图中的函数无故运行 2 次
- string - 什么是长度前缀字符串,它们在以 8 位二进制编码时是什么样子?
- java - java-应该如何将日期值传递给 MySQL?
- javascript - 下拉菜单第一次没有关闭?
- c++ - 链接到 OpenCV 时,Qt Creator 给我一个错误
- javascript - 如何实现“isHook”功能?
- vue.js - 防止元素之间的Vue渲染换行符
- java - javax.persistence.PersistenceException:org.hibernate.SessionException:会话已关闭