从Vue 文档中:
处理模板有些不同,因为大多数Webpack模板加载器(例如pug-loader)都返回模板函数而不是已编译的HTML字符串。除了使用pug-loader,我们还可以安装原始的pug。
TestComponent.vue:
<template lang="pug">
div
h2 {{ message }}
</template>
<script>
export default {
data () {
return {
message: 'Done!!! Done...'
}
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
main.js:
import Vue from 'vue'
import TestComponent from './../components/TestComponent/TestComponent.vue'
new Vue({
el: '#app',
render: h => h(TestComponent)
});
Run Code Online (Sandbox Code Playgroud)
错误:
NonErrorEmittedError: (Emitted value instead of an instance of Error)
Error compiling template:
div
h2 {{ message }}
- Component template requires a root element, rather than just text.
Run Code Online (Sandbox Code Playgroud)
使用的依赖项版本:
我正在使用 vue 单文件组件,并将标记和逻辑分别分离到.pug文件中.ts。如果您对我不统一的原因感兴趣,请参阅评论部分。
import template from "@UI_Framework/Components/Controls/InputFields/InputField.vue.pug";
import { Component, Vue } from "vue-property-decorator";
console.log(template);
@Component({
template,
components: {
CompoundControlBase
}
})
export default class InputField extends Vue {
// ...
}
Run Code Online (Sandbox Code Playgroud)
在开发构建模式下导出的模板是正确的(为了可读性我对其进行了美化):
import template from "@UI_Framework/Components/Controls/InputFields/InputField.vue.pug";
import { Component, Vue } from "vue-property-decorator";
console.log(template);
@Component({
template,
components: {
CompoundControlBase
}
})
export default class InputField extends Vue {
// ...
}
Run Code Online (Sandbox Code Playgroud)
在生产模式下,我的标记已小写。所以,console.log(template)输出:
<CompoundControlBase
:required="required"
:displayInputIsRequiredBadge="displayInputIsRequiredBadge"
<TextareaAutosize
v-if="multiline"
:value="value"
/><TextareaAutosize>
</CompoundControlBase> …Run Code Online (Sandbox Code Playgroud) 如果元素不是按钮/输入/链接tabindex="0",仅通过关注元素然后按下键来触发单击事件是不够的。Enter还需要什么?
<!--not working, even if the element has focus-->
<div tabindex=0>Trigger click event on me by Enter key!<div>
Run Code Online (Sandbox Code Playgroud) 为了实验,我下载了@typescript-eslint/eslint-plugin的源代码。这个包有两个对等依赖项:
{
"peerDependencies": {
"@typescript-eslint/parser": "^4.0.0",
"eslint": "^5.0.0 || ^6.0.0 || ^7.0.0"
},
"dependencies": {
"@typescript-eslint/experimental-utils": "4.11.1",
"@typescript-eslint/scope-manager": "4.11.1",
"debug": "^4.1.1",
"functional-red-black-tree": "^1.0.1",
"regexpp": "^3.0.0",
"semver": "^7.3.2",
"tsutils": "^3.17.1"
},
}
Run Code Online (Sandbox Code Playgroud)
如果我npm list在安装所有依赖项后运行,我会得到:
npm ERR! peer dep missing: eslint@^5.0.0 || ^6.0.0 || ^7.0.0, required by @typescript-eslint/eslint-plugin@4.11.1
npm ERR! peer dep missing: eslint@*, required by @typescript-eslint/experimental-utils@4.11.1
Run Code Online (Sandbox Code Playgroud)
这是否意味着npm想要:
npm ERR! peer dep missing: eslint@^5.0.0 || ^6.0.0 || ^7.0.0, required by @typescript-eslint/eslint-plugin@4.11.1
npm ERR! peer dep missing: …Run Code Online (Sandbox Code Playgroud) 假设我们的 GitHub 存储库包含以下 2 个 Markdown 文件:
从README.md中,我们可以通过相对路径或缩短的绝对路径引用SampleDocumentationPage :
See [sample documentation page](Documentation/SampleDocumentationPage.md)
Run Code Online (Sandbox Code Playgroud)
如果我们将包发布到 NPM,README.md将显示在包的主页上,其 URL 如下。
https://www.npmjs.com/package/$SCOPE_NAME$/$PACKAGE_ID$
Run Code Online (Sandbox Code Playgroud)
README.md中的SampleDocumentationPage.md链接是否有效?我想不是,因为SampleDocumentationPage.md的正确绝对路径是
https://github.com/$USER_NAME$/$REPOSITORY_NAME$/blob/master/Documentation/SampleDocumentationPage.md
Run Code Online (Sandbox Code Playgroud)
而相对于npm,SampleDocumentationPage.md的计算 URL为
https://www.npmjs.com/package/$SCOPE_NAME$/$PACKAGE_ID$/Documentation/SampleDocumentationPage.md
Run Code Online (Sandbox Code Playgroud)
除了仅使用绝对路径之外,还有什么可以做的吗?Markdown 中的绝对路径可能很长,如下所示:
<dl>
<dt><a href="https://github.com/TokugawaTakeshi/Yamato-Daiwa-ES-Extensions/blob/master/CoreLibrary/Package/Documentation/Arrays/getArrayElementSatisfiesThePredicateIfSuchElementIsExactlyOne/getArrayElementSatisfiesThePredicateIfSuchElementIsExactlyOne.md">getArrayElementSatisfiesThePredicateIfSuchElementIsExactlyOne</a></dt>
<dd>Returns the element of specified array matching with the predicate if such element is exactly one, otherwise error will be thrown or null will be returned (depending on dedicated option's value).</dd>
<dt><a href="https://github.com/TokugawaTakeshi/Yamato-Daiwa-ES-Extensions/blob/master/CoreLibrary/Package/Documentation/Arrays/getLastElementOfNonEmptyArray/getLastElementOfNonEmptyArray.md">getLastElementOfNonEmptyArray</a></dt>
<dd>Returns the last element …Run Code Online (Sandbox Code Playgroud) 我.env在类似问题的答案中看到了以下设置:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=myemail@gmail.com
MAIL_PASSWORD=somePassword1234
MAIL_ENCRYPTION=tls
Run Code Online (Sandbox Code Playgroud)
但是,没有任何效果。使用tls加密,我出错了
stream_socket_enable_crypto(): SSL operation failed with code 1.
OpenSSL Error messages: error:14090086:SSL routines:
ssl3_get_server_certificate:certificate verify failed
Run Code Online (Sandbox Code Playgroud)
使用ssl加密,我收到错误:
Swift_TransportException
Expected response code 220 but got code "", with message ""
Run Code Online (Sandbox Code Playgroud) 我在admin文件夹中有子public文件夹,但我想在mywebsite.loc/admin. 当前,如果输入mywebsite.loc/admin,它将是下一个响应:
但是我有路由定义admin:
Route::group(['prefix' => 'admin', 'middleware' => 'auth'], function(){
Route::get('/', [
'as' => 'AdminTop',
'uses' => //Admin\AdminController@renderTopPage'
function(){
dd('ok');
}
]);
});
Run Code Online (Sandbox Code Playgroud)
我怎样才能让它工作?
关于如何防止 Flex Child 增长的信息太多,但很难找到如何防止 Flex PARENT 增长(因为孩子)。
考虑下面的布局:
初步解决方案:
.layout {
display: flex;
flex-direction: column;
width: 640px;
height: 300px;
background: rgba(220, 20, 60, 0.2);
}
.header {
flex: 0 0 auto;
padding: 4px 8px;
background: rgba(220, 20, 60, 0.2);
}
.content {
display: flex;
flex-direction: column;
flex: 1 1 auto;
padding: 4px 8px;
background: rgba(255, 69, 0, 0.2);
overflow-y: hidden;
}
.title {
flex: 0 0 auto;
background: rgba(255, 255, 0, 0.2);
}
.splitView …Run Code Online (Sandbox Code Playgroud)我的.estintrc.yaml:
parser: "@typescript-eslint/parser"
parserOptions:
sourceType: module
project: tsconfig.json
tsconfigRootDir: ./
env:
es6: true
browser: true
node: true
mocha: true
plugins:
- "@typescript-eslint"
Run Code Online (Sandbox Code Playgroud)
有了它,我有很多错误,例如:
D:\*****\project\package.json
0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: package.json.
The extension for the file (.json) is non-standard. You should add "parserOptions.extraFileExtensions" to your config
Run Code Online (Sandbox Code Playgroud)
我没有要求检查.json文件。我想要.ts的.vue只是文件会被检查。我错过了哪个设置?
框架开发人员喜欢通过实现依赖注入概念来吹嘘。下面的实现是本机的、简单的且类型安全的。
// All below gateways and services are the abstractions
type ApplicationDependencies = Readonly<{
gateways: Readonly<{
category: CategoryGateway;
product: ProductGateway;
}>;
services: Readonly<{
authentication: AuthenticationService;
}>;
}>;
export default abstract class DependenciesInjector {
private static dependencies: ApplicationDependencies | null = null;
public static setDependencies(dependencies: ApplicationDependencies): void {
DependenciesInjector.dependencies = dependencies;
}
private static getDependencies(): ApplicationDependencies {
if (DependenciesInjector.dependencies === null) {
throw new Error("The DependenciesInjector has not been initialized");
}
return DependenciesInjector.dependencies;
}
public static get gateways(): ApplicationDependencies["gateways"] …Run Code Online (Sandbox Code Playgroud) html ×2
javascript ×2
laravel ×2
npm ×2
php ×2
typescript ×2
vue.js ×2
vuejs2 ×2
webpack ×2
css ×1
eslint ×1
flexbox ×1
focus ×1
github ×1
keyboard ×1
lazy-loading ×1
markdown ×1
package.json ×1
pug-loader ×1