我已经成功设置了jQuery和Velocity的后备,但我不知道如何使用Velocity UI做同样的事情。我可以访问
name := "slickCodeGen"
version := "1.0"
scalaVersion := "2.11.6"
scalacOptions := Seq("-unchecked", "-deprecation", "-encoding", "utf8")
libraryDependencies ++= Seq(
"com.typesafe.slick" %% "slick" % "3.0.3",
"com.typesafe.slick" %% "slick-codegen" % "3.0.3",
"org.postgresql" % "postgresql" % "9.4-1201-jdbc41",
"com.zaxxer" % "HikariCP" % "2.3.2",
"org.scalatest" %% "scalatest" % "2.2.4" % "test"
)
slick <<= slickCodeGenTask
sourceGenerators in Compile <+= slickCodeGenTask
lazy val slick = TaskKey[Seq[File]]("gen-tables")
lazy val slickCodeGenTask = (sourceManaged, dependencyClasspath in Compile, runner in Compile, streams) map { (dir, cp, r, s) =>
val outputDir = (dir / "main/slick").getPath
val username = "postgres"
val password = "xxx"
val url = "jdbc:postgresql://localhost:5555/testdb?searchpath=public"
val jdbcDriver = "com.postgresql.jdbc.Driver"
val slickDriver = "slick.driver.PostgresDriver"
val pkg = "folder1.folder2"
toError(r.run("slick.codegen.SourceCodeGenerator", cp.files, Array(slickDriver, jdbcDriver, url, outputDir, pkg, username, password), s.log))
val fname = outputDir + "/folder1/folder2/" + "Tables.scala"
Seq(file(fname))
}
看看它是否存在,如何使用Velocity UI检查相同的内容?
答案 0 :(得分:0)
如果您查看source of velocity UI,我会看到/* Note: RegisterUI is a legacy name. */
评论。
因此,请使用window.jQuery.Velocity.RegisterUI
检查它是否存在。
Fiddle without velocity UI included
结果在控制台中:undefined
。
Fiddle with velocity UI included
控制台中的结果:
(index):32 (t,a){function e(t,a,e,r){...}