我们webpack.mix在制作应用程序后看到的所有内容如下:
const { mix } = require('laravel-mix');
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css');
Run Code Online (Sandbox Code Playgroud)
我知道如何运行开发和生产构建,但不知道如何自定义它。在这个问题上,我们认为有关编译的例子sass,以css在根据构建类型不同的道路,但我想用工作es6和pug建设将是相似的。
项目结构:
民众
???css-prod
资源
? 资产
???蠢货
???css-dev
我想要:
resources/assets/sasscompile 的文件resources/assets/css-dev,没有丑化,没有串联。resources/assets/sasscompile 到resources/assets/css-prod, uglify 和 concatenate 的文件。我应该在哪里定义这些设置?
我不仅需要Babel用于 Web 应用程序(由 Webpack 构建),还需要用于 Nodejs 自动化实用程序,例如gulp. 一般情况下,web应用和nodejs的babel设置不能相同。问题是如何将其分开。
我还没有测试过,但我想我们可以.babelrc直接在 webpack 配置中定义 Nodejs 的设置和 Web 应用程序的设置,例如:
module.exports = {
// ...
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader?blacklist[]=regenerator',
options: {
presets: [
['env', {'modules': false}]
],
plugins: [
'syntax-dynamic-import',
'transform-runtime'
]
}
},
'eslint-loader'
]
}
]
}
};
Run Code Online (Sandbox Code Playgroud)
问题是哪个配置 webpack 将给予更高的优先级:.babelrc或 webpack 加载器选项(需要第二个)。
来自MDN 文档关于<input type="number">:
它们包括用于拒绝非数字条目的内置验证。
这是否意味着“尝试提交 HTML 表单时拒绝”?我输入了“4e4--23”。HTML 没有拒绝它。
因此,<input type="number"> 不能阻止非数值的输入。如果我可以以编程方式更正用户的输入,我不在乎。例如,用户输入的减号不在第一个位置 -理论上使用 JavaScript我可以删除它。
然而,这是不明显的 JavaScript 行为:当输入元素具有“数字”属性并且value是无效数字时,Element.value返回一个空字符串。这是非常棘手的编程验证:因为我们有空字符串值,验证器将返回“输入不能为空。请输入值。” 输入不为空时出错!
document.getElementById("target").addEventListener("input", blackbox => {
console.log(document.getElementById("target").value);
});Run Code Online (Sandbox Code Playgroud)
<input type="number" value="" id="target">Run Code Online (Sandbox Code Playgroud)
我怎样才能得到实际输入的值?(如果你知道Vue,也请添加Vue的解决方案。)
我将上标签的字体大小设置为 24px。我不知道在哪里可以检查元素的实际高度(如果在场景构建器中可能的话),但是盒子的上部(在图像中指定)和下部有额外的空间。
0。我需要标签的高度等于字体大小。我的意思是FontSize = Gray space surrounded by blue markers height。
如何达到?
我遇到过类似的问题 HTML/CSS。在那里,对于大多数情况来说,不是简单但有效的解决方案是负边距:before和:after伪元素。
现在有哪些适用于 JavaFX 的解决方案?
resources/static/TasksOverview.fxml通过场景生成器打开。
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="640.0" prefWidth="320.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<HBox alignment="CENTER_LEFT">
<children>
<CheckBox mnemonicParsing="false" />
<VBox>
<children>
<Label style="-fx-font-size: 24px;" text="Wake up">
<VBox.margin>
<Insets />
</VBox.margin>
</Label>
<Label style="-fx-font-size: 14px;" …Run Code Online (Sandbox Code Playgroud) 来自through2文档:
\n\n\n你需要这个吗?
\n自从 Node.js 引入了简化流构造以来,\nthrough2 的许多使用都变得多余了。考虑您是否确实需要\n使用 through2 还是只想使用\'readable-stream\' 包或\n核心\'stream\' 包(源自\'readable-stream\')。
\n
如果我理解正确的话,现在(从 2021 年开始)我们可以在没有第三方库的情况下干预流。\n我没有找到如何执行与Stream 文档through2中相同的操作。
// ...\n .pipe(through2(function (file, encoding, callback) {\n // Do something with file ...\n callback(null, file)\n }))\n\n// \xe2\x86\x91 Possible to reach the same effect natively (with core packages)?\nRun Code Online (Sandbox Code Playgroud)\n我想,2021 年一定会有一些支持 async/await 语法的方法:
\n// ...\n .pipe(newFeatureOfModernNodeJS(async function (file) {\n\n await doSomethingAsyncWithFile(file);\n // on fail - same effect as "callback(new Error(\'...\'))" of trough2\n\n return file; // …Run Code Online (Sandbox Code Playgroud) 如何CoolerFanIsOn在类中编写数组属性的getter和setter表达式CoolerSystem?我展示了非阵列属性的类似的所需表达IsOn的Lamp类.
class CoolerFan{
bool isOn;
public bool IsOn {
get => isOn;
set {
isOn = value;
}
}
}
class CoolerSystem {
private CoolerFan[] = new CoolerFan[5];
private bool[] coolerFanIsOn = new Boolean[5];
// invalid code from now
public bool[] CoolerFanIsOn {
get => coolerFanIsOn[number];
set {
coolerFanIsOn[number] = value;
}
}
}
Run Code Online (Sandbox Code Playgroud) 单击“编辑”按钮时,将出现输入字段并自动聚焦。
<button v-if="!editingMode" @click="editingMode = !editingMode">edit</button>
<input v-else type="text" value ref="input">
Run Code Online (Sandbox Code Playgroud)
export default {
name: "App",
components: {
HelloWorld
},
data: function() {
return {
editingMode: false
};
},
methods: {
onClickButton() {
this.editingMode = true;
this.$refs.input.focus();
}
}
};
Run Code Online (Sandbox Code Playgroud)
因为Vue中的重新渲染是同步的,所以当我们调用 时this.$refs.input.focus(),输入字段可能还没有渲染。我经历过两个案例:
Error in v-on handler: "TypeError: Cannot read property 'focus' of undefined"就会出现。在下面的代码中:
\nimport { Vue, Component } from "vue-property-decorator"; \n\n\n@Component({\n components: {}\n})\nexport default class ProductViewingAndEditingPage extends Vue {\n\n private readonly componentsReferencesIDs: {\n productTitleInputField: string;\n productPriceInputControl: string;\n } = {\n productTitleInputField: "ProductTitle--InputField",\n productPriceInputControl: "ProductPrice--InputComponent"\n };\n\n private readonly productDataFormValidator: InputsGroupValidator = new InputsGroupValidator({\n controls: {\n [this.componentsReferencesIDs.productTitleInputField]:\n this.$refs[this.componentsReferencesIDs.productTitleInputField],\n [this.componentsReferencesIDs.productPriceInputControl]:\n this.$refs[this.componentsReferencesIDs.productPriceInputControl]\n }\n });\n}\nRun Code Online (Sandbox Code Playgroud)\n@typescript/eslint发出@typescript-eslint/no-invalid-this问题(因为它不是 ESLint no-invalid-this,该规则理解类字段。)。
如果我使用componentsReferencesIDs静态类字段,则无法从 vue 模板中检索值。
这里不能使用箭头函数,因为这里是类字段。而且,如果我们使用 alias this,我们将面临no-this-alias规则。
我知道 ESLint 并不是唯一的事实来源。但我想要这样的理由:“因为 \xe3\x80\x88argument\xe3\x80\x89,这个 ESLint 规则不涵盖这种情况。”
\n假设根据设计,红色按钮必须仅显示在宽屏幕上。
如果只是展示它,没有什么困难,但我会跳过装饰。
.Container {
display: flex;
column-gap: 12px;
}
@media screen and (max-width: 340px) {
.Button__WideScreensOnly {
display: none;
}
}Run Code Online (Sandbox Code Playgroud)
<div class="Container">
<button class="Button">Button</button>
<button class="Button">Button</button>
<button class="Button Button__WideScreensOnly">Narrow screens only</button>
</div>Run Code Online (Sandbox Code Playgroud)
据我所知,辅助功能软件不尊重 CSS,因此第三个按钮对于辅助功能软件始终可见。但是用户(例如视力较弱但如果屏幕阅读器能够读取按钮标签则能够按下按钮)无法在狭窄的屏幕上按下按钮。
辅助软件标记隐藏元素的常见解决方案是“隐藏”属性(标签的属性,而不是 CSS 属性)。但据我所知,这些属性不能依赖于媒体查询。
css ×2
html ×2
javascript ×2
node.js ×2
vue.js ×2
c# ×1
css-grid ×1
eslint ×1
fxml ×1
javafx ×1
laravel-5.4 ×1
laravel-mix ×1
scenebuilder ×1
through2 ×1
typescript ×1
webpack ×1