小编vuv*_*uvu的帖子

如何使用长 svg 路径满足 eslint 最大行长规则?

eslint的最大行长设置为120,但是我有一个svg并且它的路径长于120,我该怎么做才能满足max-line-length?

<path d="M47.2388, 12.45 ...................."/>
Run Code Online (Sandbox Code Playgroud)

eslint

6
推荐指数
2
解决办法
4822
查看次数

如何使用 playwright 检查某个元素是否在文档中?

我想测试一个元素是否已被渲染。所以我希望期望 if 存在。有这个命令吗?

\n
await page.goto(\xe2\x80\x98<http://localhost:3000/>');\nconst logo = await page.$(\xe2\x80\x98.logo\xe2\x80\x99)\n\n// expect(logo.toBeInDocument())\n
Run Code Online (Sandbox Code Playgroud)\n

node.js playwright

6
推荐指数
2
解决办法
8069
查看次数

当加载为 true 时,Mui 自动完成不显示加载微调器

MuiAutocomplete不显示加载微调器,尽管加载设置为true。它有加载状态吗?

编辑 https://codesandbox.io/s/material-demo-forked-109rj

<Autocomplete
  loading
  id="combo-box-demo"
  options={top100Films}
  getOptionLabel={(option) => option.title}
  style={{ width: 300 }}
  renderInput={(params) => <TextField {...params} label="Combo box" variant="outlined" />}
/>
Run Code Online (Sandbox Code Playgroud)

reactjs material-ui

5
推荐指数
1
解决办法
1万
查看次数

如何使用 JSS 设置滚动条的样式?

如何使用JSS设置滚动条的样式?下面的解决方案不起作用。

   '::-webkit-scrollbar-track': {
     background: 'red',
   },
   '::-webkit-scrollbar': {
     width: 10,
     background: 'red',
   },
   '::-webkit-scrollbar-thumb': {
     background: 'green',
   },
Run Code Online (Sandbox Code Playgroud)

jss

4
推荐指数
1
解决办法
3537
查看次数

React-hook-form 方法有哪些类型?

我正在使用react-hook-form,我想在额外的组件中包含表单的某些部分。因此我需要传递一些方法。哪些typescript types方法是正确的:register, control, setValue, watch?

沙盒示例

interface INameInput {
  register: any;
  setValue: any;
  watch: any;
  control: any;
}

const NameInput: React.FC<INameInput> = (props: INameInput) => {
  const { register, control, setValue, watch } = props;

  return (
    <>
        <label>First Name</label>
        <input name="firstName" ref={register} />

        <label>Last Name</label>
        <input name="lastName" ref={register} />
    </>
  );
};

export default function App() {
  const { register, control, setValue, watch} = useForm<FormValues>();

  return (
      <form >
        <NameInput 
           register={register} 
           control={control} 
           setValue={setValue} …
Run Code Online (Sandbox Code Playgroud)

typescript reactjs react-hook-form

4
推荐指数
1
解决办法
2659
查看次数

如何在react-hook-form中为setValue设置正确的打字稿类型?

我想将该函数传递setValue()给子组件。然后我收到以下错误消息:

Type 'UseFormSetValue<Inputs>' is not assignable to type 'UseFormSetValue<Record<string, any>>'
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

如何正确传递函数?

沙盒示例

function App() {
  const {
    register,
    setValue,
  } = useForm<Inputs>({
  });

  return (
    <form>
      <Field2 setValue={setValue} register={register} />
      <input type="submit" />
    </form>
  );
}
Run Code Online (Sandbox Code Playgroud)

typescript reactjs react-hook-form

4
推荐指数
1
解决办法
1万
查看次数

Material-UI 版本 5 中的主题类型是什么?

我正在将我的项目更新到MUI 版本 5。推荐使用情感CSS。我想使用该theme财产。现在打字稿正在询问theme. 下面的版本不起作用。我如何提供类型?

import { Theme } from "@mui/material"

const Root = styled('div')(({ theme: Theme }) => ({
  background: theme.palette.grey[50],
}))
Run Code Online (Sandbox Code Playgroud)

typescript reactjs material-ui

4
推荐指数
1
解决办法
3260
查看次数

Github和Git - 在win7中使用git终端需要什么?

我想与在他们的私人服务器上使用git的团队合作.我需要从服务器推送和拉出什么?我得到了win7,我需要什么?我在githubgit上找到了一个下载.

git github

3
推荐指数
1
解决办法
60
查看次数

Intl.NumberFormat 抛出错误“Uncaught RangeError:无效的货币代码”

我想编写一个格式函数来显示欧元价格,但它会引发错误。怎么了?

\n

\r\n
\r\n
const formatVal = val => new Intl.NumberFormat("de-DE", {\n  style: "currency",\n  currency: "\xe2\x82\xac"\n}).format(val)\n\nformatVal(456)
Run Code Online (Sandbox Code Playgroud)\r\n
\r\n
\r\n

\n

抛出的错误:

\n
\n

未捕获的 RangeError:无效的货币代码:\xc3\xa2\xc2\xac

\n
\n

javascript

3
推荐指数
1
解决办法
6213
查看次数

如何使用剧作家获取 h1 标题的文本?

我想测试标题是否包含特定文本。有这个命令吗?

\n
await page.goto(\xe2\x80\x98<http://localhost:3000/>');\n\n\nexpect(await page.$("data-testid=headline")).toBe("my headline")\n
Run Code Online (Sandbox Code Playgroud)\n

playwright

3
推荐指数
1
解决办法
1万
查看次数