【问题标题】:Execute function once element is shown显示元素后执行函数
【发布时间】:2016-05-17 07:04:11
【问题描述】:

在使用luminus 创建的reagent 应用程序中

lein new luminus asdf +cljs

一旦元素(例如下面 sn-p 中的:div.container)显示后,我如何执行函数?

(defn about-page []
  [:div.container
   [:div.row
    [:div.col-md-12
     "this is the story of asdf... work in progress"]]])

【问题讨论】:

    标签: clojurescript reagent luminus


    【解决方案1】:

    我刚看了the friendly manual :) 发现 luminus 生成的应用程序与标准试剂没有什么不同。

    如下更改about-page 函数可以解决问题。 about-page-rendered

    (defn about-page-render []
      [:div.container
       [:div.row
        [:div.col-md-12
         "this is the story of asdf... work in progress"]]])
    
    (defn about-page-rendered []
      (do-what-ever-is-necessary))
    
    (defn about-page []
      (r/create-class {:reagent-render about-page-render
                       :component-did-mount about-page-rendered}))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-27
      • 1970-01-01
      • 2021-06-16
      • 1970-01-01
      • 2014-02-28
      • 1970-01-01
      相关资源
      最近更新 更多