标签: material-ui-pickers

安装Material-ui-pickers之后,编译错误'@ material-ui / core'不包含名为'makeStyles'的导出

我需要使用Material UI选择器在此处提供的inlineDatePicker组件:https ://material-ui-pickers.dev/getting-started/installation

我运行了npm -i命令,但是当我尝试编译代码时,出现此错误:

Failed to compile.

./node_modules/material-ui-pickers/dist/material-ui-pickers.esm.js
577:16-26 '@material-ui/core' does not contain an export named 'makeStyles'.

Run Code Online (Sandbox Code Playgroud)

什么?我错过了什么吗?我该如何解决?

编辑:所以检查下面,我检查了版本,它给了我这个错误:

 peer dep missing: @material-ui/core@^4.0.0-alpha.7, required by material-ui-pickers@3.0.0-alpha.2
Run Code Online (Sandbox Code Playgroud)

所以我做了npm -i@ material-ui / core @ ^ 4.0.0-alpha.7

现在又出现了另一个编译错误...

 '@material-ui/core' does not contain an export named 'createStyles'.
Run Code Online (Sandbox Code Playgroud)

我可以安装可以防止这种疯狂的@ material-ui / core版本吗?

typescript reactjs material-ui-pickers

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

未捕获的TypeError:导入@ material-ui / pickers时,Object(...)不是函数

我使用"@material-ui/core": "^3.9.3"与"@material-ui/pickers": "^3.0.0-beta.1"

当我从中导入任何内容时,@material-ui/pickers都会得到:

Uncaught TypeError: Object(...) is not a function
at Module../node_modules/@material-ui/pickers/dist/material-ui-pickers.esm.js (material-ui-pickers.esm.js:25)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Module../src/views/Event/Create.js (User.js:18)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Module../src/Routes.js (Routes.js:1)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Module../src/layouts/Admin.jsx (index.js:73)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Module../src/index.js (index.css?02e3:45)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Object.0 (Notifications.jsx:300)
at __webpack_require__ (bootstrap:781)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)
at main.chunk.js:1
Run Code Online (Sandbox Code Playgroud)

material-ui material-ui-pickers

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

material-ui-pickers示例:TypeError:Object(...)不是函数

我正在尝试使用一个裸项目并按照此处描述的安装和使用步骤来设置最基本的可能的材料UI选择器示例:https : //material-ui-pickers.dev/

我收到以下错误:

TypeError: Object(...) is not a function
Module../node_modules/@material-ui/pickers/dist/material-ui-pickers.esm.js
node_modules/@material-ui/pickers/dist/material-ui-pickers.esm.js:25
  22 | import Tab from '@material-ui/core/Tab';
  23 | import Tabs from '@material-ui/core/Tabs';
  24 | import Paper from '@material-ui/core/Paper';
> 25 | var useStyles = makeStyles(function (theme) {
  26 |   var textColor = theme.palette.type === 'light' ? theme.palette.primary.contrastText : theme.palette.getContrastText(theme.palette.background.default);
  27 |   return {
  28 |     toolbarTxt: {
Run Code Online (Sandbox Code Playgroud)

我遵循的步骤是:

create-react-app material-ui-pickers-demo
Run Code Online (Sandbox Code Playgroud)
yarn add @material-ui/core
Run Code Online (Sandbox Code Playgroud)
yarn add @material-ui/pickers
Run Code Online (Sandbox Code Playgroud)
yarn add @date-io/date-fns
Run Code Online (Sandbox Code Playgroud)
import React, { useState } from "react";
import …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs material-ui material-ui-pickers

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

无法在React js Web应用程序中使用Material-ui-pickers

我正在尝试在react应用程序中实现Material-ui-picker。

来自以下链接的交错代码

尝试实施免费设计部分

在此处输入图片说明

我使用了来自单独文件中docs的代码,并安装了所有软件包,但未找到模块:错误:无法解析“ date-fns / format”,然后我尝试从node-modules文件夹路径中导入date-fns链接像这样从'../../../../node_modules/date-fns/form'导入DateFnsUtils,然后出现以下错误。 在此处输入图片说明

有没有人成功集成了material-ui-pickers ..请提出建议

reactjs material-ui material-ui-pickers

2
推荐指数
1
解决办法
5452
查看次数