我使用最新版本的angluar。(7.2.0) 我有个人 tr 组件,如:
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-table-row',
templateUrl: './table-row.component.html',
styleUrls: ['./table-row.component.scss']
})
export class TableRowComponent implements OnInit {
@Input() character: any;
@Input() columns: string[];
constructor() { }
ngOnInit() {
}
}
Run Code Online (Sandbox Code Playgroud)
我想在表中使用这个组件,如:
<table class="mat-elevation-z8">
<tr>
<th *ngFor="let c of columns">{{c}}</th>
</tr>
<tr app-table-row class="component-style table-row-component" *ngFor="let ch of characters | async"
[character]="ch"
[columns]="columns">
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
得到如下错误:
Can't bind to 'character' since it isn't a known property of 'tr'. ("table-row class="component-style table-row-component" *ngFor="let …Run Code Online (Sandbox Code Playgroud) 我使用sbt与playframework和activator构建一个webapp.我的sbt版本是0.13.0
我将plugin.sbt文件更改为:
logLevel := Level.Warn
// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.1")
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.4.0")
Run Code Online (Sandbox Code Playgroud)
然后错误是:
F:\mysource\play-slick>sbt
F:\mysource\play-slick\project\plugins.sbt:9: error: eof expected but ';' found.
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.4.0")
^
[error] Error parsing expression. Ensure that settings are separated by blank lines.
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?
Run Code Online (Sandbox Code Playgroud)
我想知道如何在plugins.sbt中添加多个SbtPlugin?
我尝试使用最新版本的 antd(3.10.0) 和 react(16.5.2)。
我根据https://reactjs.org/docs/refs-and-the-dom.html使用新的 ref 方式
this.myRef = React.createRef();
Run Code Online (Sandbox Code Playgroud)
什么时候撕裂?应该像:
rend(){
<Select style={{ width: 200 }} ref={this.myRef}>
{Object.entries(this.state.catedict)
.map(en => <Option key={en[0]}>{en[1]}</Option>)}
</Select>
}
Run Code Online (Sandbox Code Playgroud)
但是当我想获取 Input 或 Select 的值时
我试着:
console.log(this.myRef.current.value);
Run Code Online (Sandbox Code Playgroud)
但只会得到错误的结果。
我什至发现:
console.log(this.myRef.current);
Run Code Online (Sandbox Code Playgroud)
结果是:
t {props: {…}, context: {…}, refs: {…}, updater: {…}, saveSelect: ƒ, …}
context: {}
props: {style: {…}, children: Array(2), prefixCls: "ant-select", showSearch: false, transitionName: "slide-up", …}
rcSelect: t {props: {…}, context: {…}, refs: {…}, updater: {…}, onInputChange: ƒ, …}
refs: {}
renderSelect: …Run Code Online (Sandbox Code Playgroud) 我尝试将 aws cli 与 docker 镜像一起使用。
命令行如下:
slu@machine:/c/work/dfsi$ export AWS_PROFILE=role-development
slu@machine:/c/work/dfsi$ aws ecr get-login
Run Code Online (Sandbox Code Playgroud)
发生错误
(AccessDeniedException) 调用 GetAuthorizationToken 操作时:用户:arn:aws:iam::XXXXXXXXXXXX:user/slu 无权在资源上执行:ecr:GetAuthorizationToken:*
但我可以做:
aws ecr get-login --profile=role-development
Run Code Online (Sandbox Code Playgroud)
我想做的不是明显地写--profile并尝试用隐藏来做到这一点--profile variable?
怎么做?
我使用 Windows 10 的 Linux 子系统(Windows 10 版本 1803)
我可以使用命令行:
user@laptop:~$ wslpath -w /c/
C:\
Run Code Online (Sandbox Code Playgroud)
但是当我尝试使用
user@laptop:~$ wslpath -w ~
wslpath: /home/user: Result not representable
Run Code Online (Sandbox Code Playgroud)
即使我使用:
user@laptop:~$ wslpath -w /home/user
wslpath: /home/user: Result not representable
Run Code Online (Sandbox Code Playgroud)
为什么?如何将 /home/user 转换为 windows 路径?
我在 Windows 中的主文件夹路径是 C:\Users\winuser\AppData\Local\lxss\home
我希望一些命令行可以让我返回那个字符串。
我使用 Material-UI 和 React,有如下组件:
const UserDetail = (props: ListDetailProps) => {
const oldpassword = useRef<TextFieldProps>(null);
const newpassword = useRef<TextFieldProps>(null);
const againpassword = useRef<TextFieldProps>(null);
const handlePasswordChange = async () => {
console.log(newpassword.current?.value) //expect the password value but undefined get
console.log(againpassword.current?.value) //expect the password value but undefined get
}
return (<>
<p>old password: <TextField ref={oldpassword} label="old password" type="password" /></p>
<p>new password: <TextField ref={newpassword} label="new password" type="password" /></p>
<p>new password: <TextField ref={againpassword} label="new password again" type="password" /></p>
<button onClick={handlePasswordChange}>submit</button>
</>
)
}
Run Code Online (Sandbox Code Playgroud)
我想获取 …
因为MySQL数据库不支持Arrays,我想将字符串列表映射为类似List("facebook","linkedin","local")字符串"facebook, linkedin, local".
我想用slick 2.0进行双向映射,但我不知道如何编写实例TypeMapper.
谁能为我提供一个例子?
我想写两个服务,然后用orElse让两个服务组合在一起,即service_one或service_two。它们都是偏函数。
服务一是:
val usersService = HttpService {
case request @ GET -> Root / "users" / IntVar(userId) =>
Ok("test")
}
Run Code Online (Sandbox Code Playgroud)
服务二是:
val versionService = HttpService{
case req @ GET -> Root / "version" => {
val jsonmap = ("origin" -> req.remoteAddr.getOrElse("unknown ip"))
Ok(compact(render(jsonmap)))
}
}
Run Code Online (Sandbox Code Playgroud)
然后我想把它们结合在一起。
val service = userService orElse versionService //the error happens here.
Run Code Online (Sandbox Code Playgroud)
错误是:
[error] F:\workspace\frankcheckAPI\src\main\scala\com\cardaccess\ServiceApp.scala:46: value orElse is not a member of org.http4s.HttpService
[error] val service = usersService orElse versionService
[error] ^
[error] one …Run Code Online (Sandbox Code Playgroud) 我尝试在我的无服务器 aws lambda 中应用 dynamodb。我的文件是这样的:
resources:
Resources:
StoreDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
- AttributeName: id
AttributeType: S
- AttributeName: lat
AttributeType: N
- AttributeName: lng
AttributeType: N
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:provider.environment.TableStore}
Run Code Online (Sandbox Code Playgroud)
我尝试应用 lat 和 lng 作为 storeTable 的属性,只是属性不是 key Schema,但每个 store 元素都应该具有这些属性。
但是有错误:
发生错误:StoreDynamoDbTable - Property AttributeDefinitions 与表的 KeySchema 和二级索引不一致。
如何使 lat 和 lng 只是桅杆属性,而不是索引的关键元素?
当我写打字稿时:
我有以下代码:
import * as express from 'express'
Run Code Online (Sandbox Code Playgroud)
和系统给我一个错误:
Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.
Run Code Online (Sandbox Code Playgroud)
因此,我更改为:
import express from 'express'
Run Code Online (Sandbox Code Playgroud)
它们之间有什么区别,为什么第一种方法不能调用或构造?
我只是使用 vue3 并想应用动态样式。我的 vue3 模板如下:
<ul>
<li v-for="(question, q_index) in questions" :key="q_index" v-show="question.visible" :style="{padding-left: `question.level`rem}">
<Question :title="question.title" :options="question.options" :name="question.id" :visible="question.visible" @opUpdate="opHandle"/>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我的模板上有“-”错误
Uncaught SyntaxError: Unexpected token '-'
Run Code Online (Sandbox Code Playgroud)
如何在vue3模板中设置动态填充左CSS样式?
我在视图模板中使用playframework2,如何使用我自己定义的另一个模板?
我的第一页模板是:
<!DOCTYPE html>
<html>
<head>
<title>@title</title>
<link rel='shortcut icon' type='image/png' href='@routes.Assets.at("images/favicon.png")'>
<link rel='stylesheet' href='@routes.WebJarAssets.at(WebJarAssets.locate("bootstrap.min.css"))'>
<script type='text/javascript' src='@routes.WebJarAssets.at(WebJarAssets.locate("jquery.min.js"))'></script>
<script type='text/javascript' src='@routes.WebJarAssets.at(WebJarAssets.locate("bootstrap.min.js"))'></script>
<style>
body {
margin-top: 50px;
}
</style>
</head>
<body>
@views.html.slideframework("ssssss")
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
视图中的第二页折叠命名为slideframework.scala.html和内容:
@(message: String)
<div class="col-md-9" role="main">
message
</div>
Run Code Online (Sandbox Code Playgroud)
我的路线文件是:
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
GET / controllers.Application.index()
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)
GET /webjars/*file controllers.WebJarAssets.at(file) …Run Code Online (Sandbox Code Playgroud) javascript ×3
scala ×3
components ×2
reactjs ×2
templates ×2
typescript ×2
angular ×1
antd ×1
aws-cli ×1
bash ×1
build ×1
css ×1
import ×1
material-ui ×1
operators ×1
path ×1
plugins ×1
react-hooks ×1
realpath ×1
sbt ×1
serverless ×1
slick ×1
slick-2.0 ×1
use-ref ×1
variables ×1
vue.js ×1
vuejs3 ×1