小编Kaw*_*Bit的帖子

苗条的打字稿上的苗条的自定义事件

我在我的 svelte-typescript 项目中使用 clickOutside 指令,当我将自定义事件分配给相关元素时出现此错误

Type '{ class: string; onclick_outside: () => boolean; }' is not assignable to type 'HTMLProps<HTMLDivElement>'.
  Property 'onclick_outside' does not exist on type 'HTMLProps<HTMLDivElement>'
Run Code Online (Sandbox Code Playgroud)

这是我的代码片段

Type '{ class: string; onclick_outside: () => boolean; }' is not assignable to type 'HTMLProps<HTMLDivElement>'.
  Property 'onclick_outside' does not exist on type 'HTMLProps<HTMLDivElement>'
Run Code Online (Sandbox Code Playgroud)

这是我目前使用的 clickOutside 指令https://svelte.dev/repl/0ace7a508bd843b798ae599940a91783?version=3.16.7

我是打字稿的新手,所以我真的不知道从哪里开始我的谷歌搜索,有人知道如何解决这个问题吗?感谢您的帮助

javascript typescript typescript-typings svelte svelte-3

10
推荐指数
5
解决办法
1538
查看次数

如何将Vue代码放入vue中的&lt;code&gt;标签中

这是我第一次制作 npm 包,我正在制作包的演示,我想放一个组件使用的示例。

当我将组件用法放入 pre 和 code 标记中时,如下所示

它显示这个错误

Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <style>, as they will not be parsed.
Run Code Online (Sandbox Code Playgroud)

这是我的代码(App.vue):

Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <style>, as they will not be parsed.
Run Code Online (Sandbox Code Playgroud)

我希望它像 HTML 中的普通标签一样工作。我已经尝试下载一些代码块 npm 包,它仍然不起作用,我需要你们的帮助和建议,感谢您的帮助

javascript vue.js vue-component vuejs2 vue-cli-3

2
推荐指数
1
解决办法
1万
查看次数

色轮选择器画布 javascript

我想用画布实现这样的目标

色轮

我想要实现的是我可以像这样生成色轮

$("#id").colorWheel({
  width: 200,
  height: 200
});
Run Code Online (Sandbox Code Playgroud)

我已经尝试在谷歌上搜索它,但我找不到完美的色轮选择器,我只需要没有任何滑块的色轮,我已经尝试过 iro js,但我无法从插件中删除滑块,有人可以帮忙吗我用 javascript/Jquery 和画布创建这个色轮?

html javascript css jquery canvas

-2
推荐指数
1
解决办法
3452
查看次数