我使用 Typescript 模板创建了一个普通的 create-react-app。
我添加了以下行:
<dialog inert></dialog>
Run Code Online (Sandbox Code Playgroud)
该应用程序甚至无法运行,因为打字稿抛出错误:
src/App.tsx:9:15 TS2322 中出现错误:输入 '{children: never[]; 惰性:真实;}' 不可分配给类型“DetailedHTMLProps<DialogHTMLAttributes, HTMLDialogElement>”。类型“DetailedHTMLProps<DialogHTMLAttributes, HTMLDialogElement>”上不存在属性“inert”。
我想修复它而不是忽略它,但即使忽略似乎也不起作用。
// @ts-ignore
return (<dialog inert></dialog>);
Run Code Online (Sandbox Code Playgroud) 我有两个几乎相同的页面.一个显示用户列表,另一个显示相同的列表,但具有更详细的信息.所以我调用两个扩展相同包装器的视图.但是,Laravel抱怨在verbose.blade.php中没有定义$ user.我将$ users传递给视图,该视图似乎可用于content.blade.php,但是在foreach循环中创建的$ user似乎无法在verbose.blade.php中访问.
verbose.blade.php
@extends('layout.content')
@section('user')
{{ dd($user) }}
@endsection
Run Code Online (Sandbox Code Playgroud)
nonverbose.blade.php
@extends('layout.content')
@section('user')
{{ dd($user) }}
@endsection
Run Code Online (Sandbox Code Playgroud)
content.blade.php
@extends('layout.app')
@section('content')
@foreach($users as $user)
@yield('user')
@endforeach
@endsection
Run Code Online (Sandbox Code Playgroud)
我也试过了 @yield('user', ['user' => $user])
我如何在verbose.blade.php中提供$ user?
我创建了Laravel存储库的分支,对其进行了一些更改,并将作曲家文件中的名称重命名为votemike / laravel。我现在想基于此仓库创建一个新项目,所以我打电话:
composer create-project --prefer-dist votemike/laravel --repository='{"type":"vcs","url":"https://github.com/votemike/laravel"}' testing
Run Code Online (Sandbox Code Playgroud)
但是,我的终端然后弹出,说Reading composer.json of votemike/laravel (v5.2.23)逐渐减少。然后,所产生的项目似乎是没有任何更改的普通Laravel项目。然后,我尝试:
composer create-project --prefer-dist votemike/laravel:master --repository='{"type":"vcs","url":"https://github.com/votemike/laravel"}' testing
Run Code Online (Sandbox Code Playgroud)
但这似乎也不起作用。
谁能帮我解决我需要运行的命令?我认为我的计算机不应该读取每个版本的作曲家文件。可以完全简化命令吗?
谢谢,
麦可
NextJS对 Google Fonts 进行了字体优化,它从 Google Fonts(使用 Chrome 和 IE 用户代理)下载字体定义,并将该定义放置在 DOM 的头部。这是为了加快所需字体的下载速度。
当使用具有单独指定权重的 URL(例如https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;700&display=swap )时, font-weight 的字体系列定义是单个数字。EG 700。在使用 Chrome 的 Vanilla NextJS 12 应用程序中,这会正确下载单个 Woff2 文件。
当使用具有一系列指定权重的 URL(例如https://fonts.googleapis.com/css2?family=Open+Sans:wght@300..700&display=swap )时, font-weight 的字体系列定义有两个数字。EG 300 700。在使用 Chrome 的 Vanilla NextJS 12 应用程序中,这会下载一个 Woff2 文件以及每个字体粗细的 Woff 文件。
如果我编辑NextJS 优化脚本以避免 Next 使用 IE 用户代理预下载字体定义......我正确地只下载了一个 Woff2 文件。
为什么?这是 Chrome 中的错误吗?或者NextJS?
我假设由于字体粗细是用 2 个数字指定的,Chrome 会选择从 IE 用户代理定义的更精确定义的字体系列,因此下载 Woff 字体。但如果是这样的话……为什么?
这是最终的字体定义:
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: …Run Code Online (Sandbox Code Playgroud) 我有一个 Bootstrap 内联表单,它有 6 个输入,然后是一个按钮。如果它们都适合屏幕看起来不错,但是当您缩小屏幕时,输入会一次折叠到一个下方。我尝试将每个输入包装在 col-md-2 中,但这使表单看起来很奇怪。我不确定我是否做错了什么。
有什么方法可以将输入组合在一起,以便它们折叠 6x1、3x2、2x3、1x6 之类的东西?
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<form class="form-inline">
<div class="form-group">
<input name="input1" placeholder="input1" class="form-control" required>
</div>
<div class="form-group">
<input name="input2" type="number" placeholder="input2" class="form-control" step="any" required>
</div>
<div class="form-group">
<label for="input3">Input 3
<input name="input3" type="checkbox" id="input3">
</label>
</div>
<div class="form-group">
<input name="input4" type="number" placeholder="input4" class="form-control" step="any" required>
</div>
<div class="form-group" *ngIf="!property.input3">
<input name="input5" type="number" placeholder="input5" class="form-control" required>
</div>
<div class="form-group">
<input name="input6" type="number" placeholder="input6" class="form-control" step="any">
</div>
<button class="btn btn-default">Add</button>
</form> …Run Code Online (Sandbox Code Playgroud)我正在尝试使用csv-parse读取 CSV ,但最后一行未被读取。我的代码:
const handleFiles = event => {
const f = event.target.files[0];
const parser = CsvParse({delimiter: ',', columns: true});
parser.on('readable', function(){
console.log('readable');
let record;
// eslint-disable-next-line no-cond-assign
while (record = parser.read()) {
console.log(record);
}
});
const reader = new FileReader();
reader.onload = (function() {
return function(e) {
console.log('Writing');
parser.write(e.target.result);
};
})(f);
reader.readAsText(f);
};
Run Code Online (Sandbox Code Playgroud)
输入:
Letter,Number
A,1
B,2
C,3
Run Code Online (Sandbox Code Playgroud)
输出:
Writing
readable
{Letter: "A", Number: "1"}
readable
{Letter: "B", Number: "2"}
Run Code Online (Sandbox Code Playgroud)
为什么C3不被读取?
为什么“可读”被打印两次?我有一种感觉,我没有正确理解 csv-parse。
谢谢
我刚刚将 lodash 导入从 更改为import _ from 'lodash';在import debounce from 'lodash/debounce';
我的测试中我曾经有sandbox.stub(_, 'debounce').returnsArg(0);,但现在我不知道将其更改为什么。显然sandbox.stub(debounce).returnsArg(0);行不通。不知道当仅从模块导出单个函数时该怎么做。
javascript ×2
blade ×1
composer-php ×1
csv ×1
dialog ×1
filereader ×1
font-face ×1
fonts ×1
git ×1
html ×1
html-inert ×1
laravel ×1
laravel-5 ×1
next.js ×1
php ×1
reactjs ×1
sinon ×1
testing ×1
typescript ×1