2

如何使以下代码生成类似于 HTML 中的 pprint 的可视化?

(let [clj-structure {:ui {:selected #{[:A 3]}}                                                                                       
                           :domain                                                                                                         
                           {:C {0 {:value 12}}                                                                                             
                            :D {0 {:dependants [[:C 0]] :string "3" :value "3"}                                                            
                                1 {:dependants [[:C 0]] :string "4" :value "4"}}                                                           
                            :E {2 {:dependants [] :string "2" :value "2"}                                                                  
                                3 {:dependants [] :string "10" :value "10"}}}}]                                                            
        [:p (str clj-structure)])
4

1 回答 1

4
(let [clj-structure {:ui {:selected #{[:A 3]}}                                                                                       
                           :domain                                                                                                         
                           {:C {0 {:value 12}}                                                                                             
                            :D {0 {:dependants [[:C 0]] :string "3" :value "3"}                                                            
                                1 {:dependants [[:C 0]] :string "4" :value "4"}}                                                           
                            :E {2 {:dependants [] :string "2" :value "2"}                                                                  
                                3 {:dependants [] :string "10" :value "10"}}}}]                                                            
        [:pre (with-out-str (cljs.pprint/pprint clj-structure))])

在此处输入图像描述

于 2021-01-21T19:35:30.383 回答