小编Fre*_*ark的帖子

如何在 TypeScript div 中添加 tabIndex = '0'?

我正在使用 Typescript 和 NextJS,我想添加tabIndex = '0'其中一个 div。但出现此错误Type 'string' is not assignable to type 'number'...如何实现此目的?

\n
\xe2\x80\xb9div className= 'container' tabIndex = '0'>\n
Run Code Online (Sandbox Code Playgroud)\n

html javascript frontend typescript ecmascript-6

6
推荐指数
1
解决办法
3470
查看次数

如何使用for循环进行Fetch?

我正在使用 React 创建一个应用程序。我必须获取一些数据。这是我的获取语句:

const [periods] = useFetch('/company/' + slug + '/waterfall?colIndexOffset=6 ');
Run Code Online (Sandbox Code Playgroud)

最后,这是一个6但我有这样的问题。我有句号,并且每个对象的这些句号都会改变。

const [period_waterfall] = useFetch('/company/' + firminfo.code + '/periods');
Run Code Online (Sandbox Code Playgroud)

我从那里调用周期,我发现周期的长度是这样的:

var length = period_waterfall.periods.length
Run Code Online (Sandbox Code Playgroud)

我应该多次调用此periodsfetch (次数length)。

我试过这个:

for (let i = 0; i < length; i++) {
        my_array.push(useFetch('/company/' + slug + '/waterfall?colIndexOffset=' + i))
      }
Run Code Online (Sandbox Code Playgroud)

但它给出了错误:React Hook“useFetch”可能会执行多次。可能是因为它是在循环中调用的。

我该如何处理?

javascript reactjs

5
推荐指数
1
解决办法
690
查看次数

是否可以使用BigQuery进行近似字符串匹配/模糊字符串搜索?

感谢Google提供BigQuery,这太棒了!
是否可以使用BigQuery进行近似字符串匹配/模糊字符串搜索?
Google是否计划将此功能添加到BigQuery?

当然,Google专有的近似字符串匹配算法可用于向BigQuery提供此功能,同时仍保留Google知识产权.我们搜索了所有BigQuery文档和Stack Overflow问题.当然,有很多算法可以做到这一点,但如何与BigQuery集成?

我们的需求很简单,比较两个大致相同的字符串虽然可能略有不同.例如:

"Rhodes USA" vs. "Rhodes USA, LLC", vs. "Rhodes USA LLC".  
Run Code Online (Sandbox Code Playgroud)

从我们的BigQuery测试中可以看出,两个字符串需要完全匹配BigQuery才能加入它们,甚至是每个字符串中的尾随空格数.将非常感谢添加此功能或与BigQuery集成的指南.这是对位于威斯康星州密尔沃基市的区域性,创新型,分数喷气式飞机所有权公司Milwaukee Jets的支持.再次感谢Google提供BigQuery.

非常感谢和最诚挚的问候,Andrew Paullin(414)212-5372

google-bigquery

3
推荐指数
1
解决办法
1027
查看次数

How to fix "gyp ERR! stack Error: Can't find Python executable python" on Windows?

I was trying to install chimp on my windows computer globally but could not succeed. Here is the error that I have been shown. Can anybody please help me regarding this?

 C:\Users\Shahin>npm install -g chimp
npm WARN deprecated babel-preset-es2015@6.24.1:   Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
C:\Users\Shahin\AppData\Roaming\npm\chimp -> C:\Users\Shahin\AppData\Roaming\npm\node_modules\chimp\bin\chimp.js

> fibers@1.0.15 install C:\Users\Shahin\AppData\Roaming\npm\node_modules\chimp\node_modules\fibers
> node build.js || nodejs build.js


C:\Users\Shahin\AppData\Roaming\npm\node_modules\chimp\node_modules\fibers>if not defined npm_config_node_gyp (node "C:\Users\Shahin\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" …
Run Code Online (Sandbox Code Playgroud)

windows node.js npm meteor chimp.js

3
推荐指数
1
解决办法
5708
查看次数

用鼠标移动 img

我希望能够在图像放大后在其容器内移动 img,因为正如您所看到的,一旦您单击图像,它就会变得太大而您看不到整个图像。另外,一旦图像未被悬停,如何使图像恢复正常?提前致谢。

// Zoom in/out clothing img
  $('.image').click(function() {
    $(this).toggleClass('normal-zoom zoom-in');
  });
Run Code Online (Sandbox Code Playgroud)
.container {
  width: 800px;
  margin: 0 auto;
  border: 2px solid black;
  display: flex;
}

.img-wrapper {
  margin: 10px;
  overflow: hidden;
}

.image {
  width: 100%;
  height: 100%;
}

.text {
  width: 40%;
  padding: 20px;
}

.normal-zoom {
  transform: scale(1);
  cursor: zoom-in;
  transition: all 250ms;
}

.zoom-in {
  transform: scale(1.6);
  cursor: zoom-out;
  transition: all 250ms;
}
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container">
  <div class="img-wrapper">
    <img src="https://static1.squarespace.com/static/560c458be4b0af26f729d191/560c5de0e4b083d9c365515f/560d53d4e4b03b1013fd40de/1443714010032/lauren-winter-wide-pant-natural_0178.jpg?format=750w" class="image normal-zoom">
  </div>
  <p class="text">Kept …
Run Code Online (Sandbox Code Playgroud)

html javascript css-transforms

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