HTMLマークアップを含む文字列があり、次のようにドキュメントから作成したい:
Doc.FromHtm "<div><p>.....</p>.....</div>"
私はこれが今は不可能であることを理解しています。わかりました、正確に縫うことができないのは、jqueryを使用して大まかに釘付けにしようとしました:
JQuery.JQuery.Of( "." + class'name ).First().Html(html'content)
ただし、このコードを呼び出すには、Doc 要素のイベント ハンドラーを指定する必要があります。ただし、UI.Next には実装されていません。特定の CSS クラスを使用してモデルの変更を非同期的に追跡しようとしました。
let inbox'post'after'render = MailboxProcessor.Start(fun agent ->
let rec loop (ids'contents : Map<int,string>) : Async<unit> = async {
// try to recive event with new portion of data
let! new'ids'contents = agent.TryReceive 100
// calculate the state of the agent
let ids'contents =
// merge Map's
( match new'ids'contents with
| None -> ids'contents
| Some (new'ids'contents) ->
new'ids'contents @ (Map.toList ids'contents)
|> Map.ofList )
|> Map.filter( fun id content ->
// calculate CSS class name
let class'name = post'text'view'class'name id
// change it's contents of html
JQuery.JQuery.Of( "." + class'name ).First().Html(content).Size() = 0)
// accept the state of the agent
return! loop ids'contents }
loop Map.empty )
次に、たとえば 1 つの要素の場合:
inbox'post'after'render.Post [id, content]
しかし、それは難しすぎて信頼性が低く、実際には機能していません。可能であれば、問題を解決する方法を教えてください。前もって感謝します!