当我使用命令时hugo,它会index.html在Public文件夹中生成。当我打开时index.html,网站加载如下:
但是当我在hugo serve本地使用该命令时,它会生成链接http://localhost:1313/,并且站点加载正确。它像这样加载:
我认为问题是由于文件或任何类似内容的渲染不正确。
我的做法:
relativeURLs = true,但仍然无法正确呈现。uglyURLs = trueconfig.tomlbaseurl = "/"在config.toml文件中设置,但这也不起作用。我有一个 YoutubePlayer 在我的 Motion Layout 中播放视频。我想实现这个youtube-like motion
https://developer.android.com/training/constraint-layout/motionlayout/examples#youtube-like_motion
这里的问题是,在上面提供的示例中,他们使用 ImageView 而不是 YoutubePlayer 界面来完成动画。但不幸的是,youtube 播放器界面似乎“覆盖”了点击侦听器,并且只允许点击而不是滑动。(这是我的推论)。
我想知道它是如何在 youtube 应用程序中实现的。如果有人可以回答我,请做。我需要这在我的应用程序。
我提出了一个问题,请检查一下。 https://issuetracker.google.com/issues/162155197
这是我尝试过的:
当设置touchRegionId为 youtube 播放器前面或后面的视图时,界面的点击被完全禁用。动画虽然有效。我看不到此选项的解决方案,因为我认为此行为是设计使然。
当设置limitBoundsTo为视图时,它会完成它的工作。它将OnSwipe动作区域限制为这样的视图边界。这完全符合我的需要,直到 YOUTUBE 播放器界面初始化。初始化后,OnSwipe不再检测到,界面只侦听点击,例如,您可以暂停视频。如果限制查看的限制大于 youtube 界面,我可以在视图的其余部分滑动。但是 youtube 界面不会收听滑动。也许界面不支持滑动?
我试过不设置上述任何一项。只是简单的 OnSwipe 与拖动方向。在初始化 youtube 之前,滑动无处不在。当它被初始化时,youtube 播放器界面使用的像素停止监听滑动,它们只监听点击。
考虑到2.和3.,我觉得这是接口本身的问题。不管你有什么建议,请告诉我。谢谢你。
这是我的运动布局:
<androidx.constraintlayout.motion.widget.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/blackBackground"
android:nestedScrollingEnabled="false"
app:layoutDescription="@xml/activity_main_scene"
app:motionDebug="SHOW_ALL">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/player_background"
android:layout_width="match_parent"
android:layout_height="0dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:touchscreenBlocksFocus="false"
android:clickable="false"
android:background="#000000"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:id="@+id/main_player"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="@id/player_background"
app:layout_constraintLeft_toLeftOf="parent" …Run Code Online (Sandbox Code Playgroud) android android-animation android-layout android-youtube-api android-motionlayout
参考 Angular CDK 拖放,我尝试创建一个带有左侧边栏和主要内容区域的简单仪表板。这两个区域都将包含独特的自定义组件,这些组件需要可拖动,并且可以在其包含的区域内重新排序并转移到另一个区域。
例如。侧边栏包含Comp和Comp1,然后我可以在该区域内重新排序它们并将它们转移到主要内容区域。
据我了解,Angular Material CDK 拖放仅适用于列表。此外,列表中的项目必须具有相似的类型才能重新排序/转移。
有没有办法利用CDKDragandCDKDropList来处理静态项而不是数组中的项?我无法重新排序自定义组件或将其转移到不同的下拉列表。
我创建了一个示例项目:https://stackblitz.com/edit/ng-mat-dnd 演示:https://ng-mat-dnd.stackblitz.io/
应用程序组件.html
<div class="example-container">
<h2>Sidebar</h2>
<div cdkDropList #sidebarList="cdkDropList" [cdkDropListData]="sidebar" cdkDropListConnectedTo="[mainList]"
class="example-list" (cdkDropListDropped)="drop($event)">
<div class="example-box" cdkDrag>
<app-demo-comp-2 [btn]=2></app-demo-comp-2>
</div>
<div class="example-box" cdkDrag>
<app-demo-comp [ddn]=2></app-demo-comp>
</div>
<div class="example-box" cdkDrag>
<app-demo-comp-3 [txt]=3></app-demo-comp-3>
</div>
</div>
</div>
<div class="example-container">
<h2>Main</h2>
<div cdkDropList #mainList="cdkDropList" [cdkDropListData]="main" cdkDropListConnectedTo="[sidebarList]"
class="example-list" (cdkDropListDropped)="drop($event)">
<div class="example-box" cdkDrag>
<app-demo-comp [ddn]=1></app-demo-comp>
</div>
<div class="example-box" cdkDrag>
<app-demo-comp-2 [btn]=3></app-demo-comp-2>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
应用程序组件.ts
import { …Run Code Online (Sandbox Code Playgroud) 我一直在寻求通过合并异步/等待处理来更新我的 Express 技能,并且有一个简单的问题。
从我在网上看到的示例来看,大多数请求都被结构化包装在 try/catch 块内,并在处理它们之前将任何等待任务添加到变量中。
app.post('/signup', async(req, res) => {
const { email, firstName } = req.body
const user = new User({ email, firstName })
const ret = await user.save()
res.json(ret)
})
Run Code Online (Sandbox Code Playgroud)
我的代码如下所示:
app.route("/articles")
// GET: articles
.get(async (req, res) => {
await Article.find((err, results) => {
if (!err) {
res.json(results);
} else {
res.send(err);
};
});
})
Run Code Online (Sandbox Code Playgroud)
我应该将 Mongoose 的响应分配给一个变量作为第一个代码块示例并在 try/catch 中进行处理,还是我的代码本质上做同样的事情,并且以一种最佳实践的方式?
提前致谢!
干杯,詹姆斯
android ×1
angular ×1
async-await ×1
css ×1
express ×1
hugo ×1
node.js ×1
static-site ×1
typescript ×1
web ×1