db.opt.Select(z => new {
z.QuestionTitle,
Count = z.Responces.Where(x => x.Responseval == Constants.options.Agree).Count(),
Perc = (totresponcecount/Count)*100
}).ToList();
Run Code Online (Sandbox Code Playgroud)
在上述的λ,而对于如计算百分比我想写(totresponcecount/Count)*100其中Count在上述声明中已经计算.
那么如何才能访问Count写入的值Perc = (totresponcecount/Count)*100?
我有一个项目(现有项目),其前端是用命名空间打字稿编写的。我无法从命名空间方法重写所有打字稿文件以导出/导入 es6 语法。
但是下面的代码工作正常。如果我添加我的新 ts 模块或反应组件没有问题,只要我将它包装在命名空间中并按类或命名空间前缀调用它,如果它在其他命名空间中。
问题是我不能使用带有 import 语句的外部模块。我该如何使用..?因为 import 语句抛出错误。
为了更具体地说明下面的代码,我想使用 react-redux,
当我检查 node_moduels 文件夹时,我看到了 @types 文件夹,从那里引用了 React 名称空间我假设由于 tsconfig 中的这一行
"typeRoots": [
"./node_modules/@types/"
]
Run Code Online (Sandbox Code Playgroud)
但是当我安装npm install --save @types/react-redux它时,它也在节点模块的@types 文件夹下创建了带有 index.ts 的 react-redux 文件夹。但它没有命名空间导出行,React 类型文件如何具有如下所示的内容。
export as namespace React;
declare namespace React {
....
}
Run Code Online (Sandbox Code Playgroud)
最终..如何在这个项目中使用第三方节点模块,尤其是 react-redux。或任何简单的节点模块,并在任何 ts 文件中访问它简单的模块,例如“react-bootstrap” 下面是包装在命名空间中的反应组件的简单 ts 文件,该文件工作正常(import staement 除外)
import { createStore } from 'redux'; //if i add this line this is throwing error.
namespace Profile.Sample {
import { createStore } from …Run Code Online (Sandbox Code Playgroud) typescript reactjs react-redux typescript-typings typescript2.0
我想table通过CSS选择器访问页面.
该表的结构如下:
<table border="1" width="560" cellspacing="0">
<tr>
<td height="28" colspan="3" bgcolor="#FFFFF...>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
基本上我需要在一行中使用jquery或css选择器来访问tablewithborder=1
没有与table第n次访问的父子映射相关联的类或id 也是不可能的
基本上是选择table在那里table border=1(border = 1不是里面style=""),它仅仅是HTML标记
<table border=1"> ....</table>
Run Code Online (Sandbox Code Playgroud)