默认情况下,材料UI主题是几个预先定义的对象,例如的组合typography: {...},palette: {...}等等。
是否可以将自定义对象添加到此设置中并仍然使用createMuiTheme?
例如,主题对象将变为:
const theme = {
palette: {
primary: '#000'
},
typography: {
body1: {
fontFamily: 'Comic Sans'
}
},
custom: {
myOwnComponent: {
margin: '10px 10px'
}
}
}
Run Code Online (Sandbox Code Playgroud) 运行时:npm version prepatch我收到错误:“Git 工作目录不干净。” 然后是尚未提交的文件列表。
但是,我想做这个预发布以使用私有 npm 注册表在本地测试一些东西。这意味着我不必使用 Git 提交文件。
是否可以在没有干净的 git 工作目录的情况下更新 package.json 中的版本?
我正在学习stream-adventure课程。其中一项任务是创建一个 http 服务器,将所有请求转换为大写并在响应中返回。
现在我设法让它工作并且任务通过了。但是,控制台给了我一个 TimeoutOverflowWarning。
(node:15710) TimeoutOverflowWarning: 4294967296000 does not fit into a 32-bit signed integer.
Timer duration was truncated to 2147483647.
(node:15710) TimeoutOverflowWarning: 4294967296000 does not fit into a 32-bit signed integer.
Timer duration was truncated to 2147483647.
Run Code Online (Sandbox Code Playgroud)
我想知道这是内存泄漏还是由我的代码引起的,或者是否是其他原因。因为错误消息中提到了 32 位,我想知道这是否与我使用 2016 年的 Macbook Pro 以 64 位运行有关。(节点 v10.17.0)
代码:
'use-strict'
const through = require('through2')
const http = require('http')
const port = process.argv[2]
const uppercaser = through(function (buffer, _, next) {
this.push(buffer.toString().toUpperCase())
next()
});
const server = http.createServer(function …Run Code Online (Sandbox Code Playgroud) 我已经安装了 typescript 以在我的 Create React App 项目中使用。我想逐步将ES文件重构为TS。
但是 linter 现在也将 .js 和 .jsx 文件解析为 Typescript。
/project/file.js
19:35 warning Missing return type on function @typescript-eslint/explicit-function-return-type
20:35 warning Missing return type on function @typescript-eslint/explicit-function-return-type
Run Code Online (Sandbox Code Playgroud)
是否可以将 .js 和 .jsx 文件解析为 Ecmascript,将 .ts 和 .tsx 解析为 Typescript?
我的配置是:
./eslintrc
{
"extends": [
"airbnb",
"prettier",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint"
],
"parser": "@typescript-eslint/parser",
"rules": {
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", ".tsx", ".ts"] }],
}
}
Run Code Online (Sandbox Code Playgroud)
./tsconfig.json
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext" …Run Code Online (Sandbox Code Playgroud) 当使用the_posts_pagination(参见codex)时,分页显示标题"post navigation".
是否有可能将其关闭?
例如使用类似的东西:
the_posts_pagination( array(
'title' => '', // this should hide the title
'prev_text' => __( 'Previous', 'twentyfifteen' ),
'next_text' => __( 'Next', 'twentyfifteen' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( '', 'nieuwedruk' ) . ' </span>',
) );
Run Code Online (Sandbox Code Playgroud) /public当我在本地开发时,当我将文件夹放入以下位置时会找到图像/src/:
# locally\n./src/public/images/\nRun Code Online (Sandbox Code Playgroud)\n\n然后,当我进行部署时,找不到图像。但是当我将 public 文件夹放在 src 之外时,会发现图像:
\n\n# deploy\n./public/images/\n./src/\nRun Code Online (Sandbox Code Playgroud)\n\n我将图像用作:
\n\n<img src="/images/my-image.jpg" alt="" />\nRun Code Online (Sandbox Code Playgroud)\n\n是否有我必须使用的配置设置?
\n\n完整结构:
\n\n|- .now/\n| |- project.json\n| \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 README.txt \n|- next.config.js\n|- now.json\n|- src/\n| |- .next/\n| | |- build-manifest.json\n| | |- react-loadable-manifest.json\n| | |- cache/\n| | |- server/\n| | \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 static/\n| |- pages/\n| \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 next-env.d.ts\nRun Code Online (Sandbox Code Playgroud)\n 在我的一项测试中,我期待某种 DOM 更改。然而,它所在的页面相当长。
所以对于较小的组件我通常做的就是使用screen.debug()方法。但由于文件很长,我也开始使用DEBUG_PRINT_LIMIT=50000. 现在最终得到了我得到的结果。
但这让我想知道,是否可以将输出保存在文件中?
我已经安装了最新版本的指南针,sass和susy.但我仍然收到此错误:
Unable to activate susy-2.1.1, because sass-3.2.17 conflicts with sass (~> 3.3.0)
Run Code Online (Sandbox Code Playgroud)
谁知道这个Ruby的工作原理是什么?
这是我安装的宝石列表:
*** LOCAL GEMS ***
CFPropertyList (2.2.0)
chunky_png (1.3.0)
compass (0.12.4)
compass-core (1.0.0.alpha.19)
compass-import-once (1.0.4)
compass-rails (1.1.3)
fssm (0.2.10)
libxml-ruby (2.6.0)
multi_json (1.9.2)
nokogiri (1.5.6)
rb-fsevent (0.9.4)
rubygems-update (2.2.2)
sass (3.3.4, 3.3.3, 3.2.17)
sqlite3 (1.3.7)
susy (2.1.1)
Run Code Online (Sandbox Code Playgroud) 我正在使用dayjs在 js 中转换我的时间。
根据关于本地化的 material-ui-pickers页面,它给出了如何本地化日期选择器的示例。
但是没有运气尝试这个例子:
import React from "react";
import ReactDOM from "react-dom";
import {
KeyboardDatePicker,
MuiPickersUtilsProvider
} from "@material-ui/pickers";
// import dayjs from 'dayjs';
import "dayjs/locale/nl";
import DayjsUtils from "@date-io/dayjs";
import "./styles.css";
function App() {
return (
<div className="App">
<MuiPickersUtilsProvider utils={DayjsUtils} locale="nl">
<KeyboardDatePicker />
</MuiPickersUtilsProvider>
</div>
);
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
Run Code Online (Sandbox Code Playgroud)
工作示例:https : //codesandbox.io/s/clever-field-2gzmf
我还尝试了通用dayjs 文档 I18n 中描述的一些方法,这似乎也不起作用。
有人知道出了什么问题吗?我觉得这是一件小事。
经过进一步调查,似乎我对 dayjs 的实现是错误的,或者存在错误。因为瞬间 JS 正在工作,正如这个活生生的例子所示:https : //codesandbox.io/s/young-snow-ejinu …
在架构中,我想根据父级的同级调整架构。
例如:如果toggleMonday为true,那么工作日->星期一应该有一个特定的验证模式。
现在下面的例子可以工作了。然而,它相当冗长。
const schema = yup.object().shape({
toggleMonday: yup.bool().required(),
toggleTuesday: yup.bool().required(),
toggleWednesday: yup.bool().required(),
toggleThursday: yup.bool().required(),
toggleFriday: yup.bool().required(),
toggleSaturday: yup.bool().required(),
toggleSunday: yup.bool().required(),
weekdays: yup.object()
// works, toggleMonday is a sibling of weekdays
.when('toggleMonday', {
is: true,
then: yup.object().shape({
monday: yup.array().of(yup.object().shape(daySchema)).daySchemaFirstTimeslotRequired(),
tuesday: yup.array().of(yup.object().shape(daySchema)),
wednesday: yup.array().of(yup.object().shape(daySchema)),
thursday: yup.array().of(yup.object().shape(daySchema)),
friday: yup.array().of(yup.object().shape(daySchema)),
saturday: yup.array().of(yup.object().shape(daySchema)),
sunday: yup.array().of(yup.object().shape(daySchema)),
}),
})
.when('toggleTuesday', {
is: true,
then: yup.object().shape({
monday: yup.array().of(yup.object().shape(daySchema)),
tuesday: yup.array().of(yup.object().shape(daySchema)).daySchemaFirstTimeslotRequired(),
wednesday: yup.array().of(yup.object().shape(daySchema)),
thursday: yup.array().of(yup.object().shape(daySchema)),
friday: yup.array().of(yup.object().shape(daySchema)),
saturday: yup.array().of(yup.object().shape(daySchema)),
sunday: yup.array().of(yup.object().shape(daySchema)),
}),
})
// etc.
}); …Run Code Online (Sandbox Code Playgroud) reactjs ×4
javascript ×3
material-ui ×2
eslint ×1
jestjs ×1
next.js ×1
node.js ×1
npm ×1
pagination ×1
ruby ×1
rubygems ×1
susy-compass ×1
susy-sass ×1
through2 ×1
typescript ×1
vercel ×1
wordpress ×1
yup ×1