在vscode中使用antd框架的按钮提示 [英] Button hints using antd framework in vscode

查看:1263
本文介绍了在vscode中使用antd框架的按钮提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在vscode中使用antd的Button和Input.但是它在Button上显示错误,我想知道为什么.

I'm using Button and Input of antd in vscode. But It shows error on Button and I want to know why.

我尝试了Input,但没有显示错误.如图所示.

I have tried Input, and it shows no error. Which is showed in the picture.

import React from 'react';
import styles from './index.css';
import router from 'umi/router';
import {Input, Button} from 'antd';

export default function() {
  const handleClick=()=>{
    router.push('/homepage/');
  }
  return (
    <div className={styles.normal}>
      <div className={styles.welcome} />
      <h1 className={styles.title}>login</h1>
      <ul className={styles.list}>
        <li><label>username:</label><Input className={styles.input} placeholder="username"/></li>
        <li><label>password:</label><Input className={styles.input} placeholder="password"/></li>
        <li>
          <Button type="primary" shape="round" onClick={handleClick}>login</Button>
        </li>
      </ul>
    </div>
  );
}

实际输出显示:

<--language:lang-none-->
"message": "Type '{ children: string; type: \"primary\"; shape: \"round\"; onClick: () => void; }' is missing the following properties from type 'Pick<Pick<(Readonly<AnchorButtonProps> & Readonly<{ children?: ReactNode; }>) | (Readonly<NativeButtonProps> & Readonly<{ children?: ReactNode; }>), \"defaultChecked\" | \"defaultValue\" | ... 257 more ... | \"block\"> & Pick<...> & Pick<...>, \"defaultChecked\" | ... 256 more ... | \"shape\">': defaultChecked, defaultValue, suppressContentEditableWarning, suppressHydrationWarning, and 250 more."

plus,我想问一下如何使用静态资源?该示例项目仅使用css背景url方式显示图片.

plus, I want to ask how to use static resource? The sample project just use the css background url way to show pictures.

推荐答案

你好,我在package.json中已将@ types/react更新为16.8.11.这解决了我的问题.

Hello I have updated @types/react as 16.8.11 in my package.json. This solved my problem.

这篇关于在vscode中使用antd框架的按钮提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆