我使用"lein new compojure-app“创建了一个web项目,project.clj中已经导入了hiccup:
:dependencies [[org.clojure/clojure "1.8.0"]
[compojure "1.5.2"]
[hiccup "1.0.5"]我可以看到jar文件
我在home.clj中为ide使用了intellij:
(ns ansible.routes.home
(:require [compojure.core :refer :all]
[ansible.views.layout :as layout]
[hiccup.form :refer :all]
))但是在写的时候:
(form-to [ :post "/"]intellij告诉我form-to can't be resolved,如果我使用这个:
[hiccup.form :as hf]然后写下
(hf/intellij告诉我可以使用function:group,input-filed,make-id,make-name,with-group,但是没有form-to,但是form-to是包hiccup.form中的一个函数
我该如何解决这个问题?
发布于 2019-01-29 12:35:54
通常,将:require与:refer :all一起使用被认为是不好的形式,因为它可能会在您不注意到的情况下隐藏一些函数。
检查home.clj中需要的任何其他名称空间是否已经有一个名为form-to的函数。尝试使用类似以下内容:
(ns myapp.routes.home
(:require [compojure.core :as cc :refer [defroutes GET]]
[myapp.views.layout :as layout]
[hiccup.form :as hf]))
(defn home []
(layout/common [:h1 "Hello World!"]))
(defroutes home-routes
(GET "/" [] (home)))https://stackoverflow.com/questions/54358255
复制相似问题