我想使用 material-ui-next 的 CSS-in-JS、withStyles 或主题在我的 Web 应用程序正文中设置背景图像?如果可能,我想避免使用外部 CSS 文件。
正如文档中的示例所示
await User.query()
返回一个包含用户数组的承诺。
await User.query().findById(1)
返回 ID 为 1 的用户。
如何知道User.query()
何时需要执行它或者它是否被链接。
我假设一旦User.query()
被调用,请求就已经传输到数据库服务器,因此无法修改。但是,将其链接起来.findById(1)
会修改请求,以便它使用条件 where 构建查询User.id = 1;
,然后将其传输到数据库服务器?。这是如何运作的?
我有一个以 Promise 作为其值的对象。对象字段可以具有不同类型的值,例如函数、promise、字符串、数字或其他对象。如何实现一个等待对象中所有承诺解析的函数?
const asyncFunction = () => {
return Promise.resolve("Resolved!")
}
const nonAsyncFunction = () => {
return "Resolved!"
}
const awaitObjectWithPromise = (obj) => {
// Returns a promise which waits for all
// the promises inside "obj" to be resolved.
}
let obj = {
key1: asyncFunction(),
key2: nonAsyncFunction(),
key3: "Some Value",
parent1: {
key1: asyncFunction(),
key2: nonAsyncFunction(),
key3: "Some Value"
}
}
awaitObjectWithPromise(obj).then((obj) => {
console.log(obj);
// Should output:
// {
// key1: "Resolved!",
// key2: …
Run Code Online (Sandbox Code Playgroud)目前,我有这个:
如何使白色条纹具有透明度渐变?
这是我当前的代码。
body {
background: gray;
}
.bar {
height: 50px;
width: 100%;
background-image: linear-gradient(90deg, #FC0252 0%, #01Fdd9 100%);
border-radius: 100rem;
position: relative;
}
/** Stripes. */
.bar::before {
content: "";
position: absolute;
border-radius: 100rem;
height: 100%;
width: 100%;
background-size: 90px 100%;
background-image: linear-gradient(
120deg,
transparent,
transparent 40%,
white 40%,
white 60%,
transparent 60%
);
}
Run Code Online (Sandbox Code Playgroud)
<div class="bar"></div>
Run Code Online (Sandbox Code Playgroud)
async-await ×1
css ×1
es6-promise ×1
javascript ×1
knex.js ×1
material-ui ×1
node.js ×1
objection.js ×1
reactjs ×1