我创建了一个网站,如果用户点击,它会发出声音.为了防止声音重叠,我不得不添加代码:
n.pause();
n.currentTime = 0;
n.play();
Run Code Online (Sandbox Code Playgroud)
但这会导致错误:
The play() request was interrupted by a call to pause()
每次在另一次触发后立即触发声音事件时出现.声音仍然很好,但我想防止这个错误信息不断弹出.有任何想法吗?
提前致谢!
所以我试图运行VSCode调试器运行我的express程序,但是我注意到它弄乱了相对目录路径。
当使用诸如JIMP
Node图像操纵器之类的模块时,当我从Powershell运行应用程序时,我需要输入相对于项目根目录的路径(“ package.JSON
is” 所在的位置)以查找图像。但是,当我从VSCode调试器运行它时,出现一个错误,因为它正在查找相对于我的app
目录的图像,该目录是我的项目根目录中的一个文件夹。
有可以修改的配置可以解决此问题吗?
launch.json
:
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "npm start",
"program": "${workspaceRoot}/app/app.js"
}
]
}
Run Code Online (Sandbox Code Playgroud)
jsconfig.js
:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"allowSyntheticDefaultImports": true
},
"exclude": [
"node_modules"
]
}
Run Code Online (Sandbox Code Playgroud)
提前致谢
在我的testcafe测试中,我需要获取我正在使用的库的构造函数,以便对其调用静态方法。
但是,我无法使用给定的ClientFunction和Eval方法来执行此操作。我该如何获取构造函数?
我尝试了以下方法:
// Does not work, because the docs say it only allows using ClientFunction for obtaining "serializable" values
let getSortable = new ClientFunction(() => window.Sortable);
test('test', async t => {
let Sortable = await getSortable();
console.log(Sortable); // Logs undefined
});
Run Code Online (Sandbox Code Playgroud)
test('test', async t => {
let Sortable = await t.eval(() => window.Sortable);
console.log(Sortable); // Logs undefined (not sure why)
});
Run Code Online (Sandbox Code Playgroud) 我有两个组件,一个item
组件和一个folder
组件。每个都item
包含它自己的folder
组件,每个folder
组件都包含一个 s 列表item
。
因此,我尝试在组件item
中使用该组件folder
,反之亦然,但是,我收到错误:unknown custom element: <item> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
尽管我name
在两个组件上都设置了选项。有任何想法吗?
代码如下
item.vue
<template>
<div class="item" style="height: 30px">
. . .
<folder v-if="item.hasChildren" :id="id"></folder>
</div>
</template>
<script scoped>
import Folder from './folder.vue';
export default {
name: 'item',
props: ['id'],
components: {
Folder
}
};
</script>
Run Code Online (Sandbox Code Playgroud)
folder.vue
<template> …
Run Code Online (Sandbox Code Playgroud) javascript ×4
audio ×1
debugging ×1
e2e-testing ×1
html ×1
npm ×1
testcafe ×1
vue.js ×1
web-testing ×1