我有一个使用xmonad的XMonad.Prompt.Input的新想法.我认为这真的很酷,如果一个人可以制作一个简单的计算器来计算用户输入的内容并在下一个提示的文本中返回结果,当用户按下escape时结束......问题是,我没有非常知道如何处理类型......
到目前为止我有这个:
runAndGetOutput cmd = do
(_, pout, _, phandle) <- runInteractiveCommand cmd
waitForProcess phandle
a <- hGetContents pout
return a
calcPrompt :: XPConfig -> String -> X ()
calcPrompt c ans =
inputPrompt c ans ?+ \ next ->
calcPrompt c (runAndGetOutput ("calc" ++ next))
Run Code Online (Sandbox Code Playgroud)
哪个不起作用.我明白了:
Couldn't match expected type `[Char]' with actual type `IO String'
Expected type: String
Actual type: IO String
In the return type of a call of `runAndGetOutput'
In the second argument of `calcPrompt', namely …Run Code Online (Sandbox Code Playgroud) 我想使用jQuery Selectable从表中选择行.问题是jQuery似乎劫持了所有点击事件,因此我无法在表格中使用任何可点击的内容(在我的情况下为链接).
HTML:
<table class="sel-table">
<thead>
<th>col1</th>
<th>col2</th>
<th>col3</th>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.google.com">click me! a1</a>
</td>
<td>a2</td>
<td>a3</td>
</tr>
<tr>
<td>b1</td>
<td>b2</td>
<td>b3</td>
</tr>
<tr>
<td>c1</td>
<td>c2</td>
<td>c3</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
CSS:
.ui-selectable>.ui-selected
{
background-color: #a6c9e2;
}
Run Code Online (Sandbox Code Playgroud)
使用Javascript:
$(".sel-table>tbody").selectable({filter: 'tr'});
Run Code Online (Sandbox Code Playgroud)
JSFiddle:http://jsfiddle.net/qt67rf12/
当您单击该链接时,没有任何反应,可选择处理该事件.但是,中间按钮(在新选项卡中打开)可以很好地工作.什么阻止链接上的默认操作,我该如何解决?