单击提交时从表单获取值

时间:2019-07-17 06:41:08

标签: clojurescript

(defn text-input [label] [:div.row [:div.col-md-2 [:span label]] [:div.col-md-3 [:input {:type“ text”:类“ form-control”:style {:border“ 1px纯红色”}}]]]]]))(defn hello-world [] [:div.page-header [:h1“ Reagent Form”] [text-input“ First名称“] [文本输入”姓氏“] [文本输入”手机号码“] [文本输入”地址“] [:按钮{:键入” submit“:类” btn btn-default“:单击#(。log js / console(clj-> js @state))}“提交”]])

1 个答案:

答案 0 :(得分:0)

如果要从事件中打印值,则可以使用如下单击处理程序:

Cordova command 'build' started ...
cordova-android-play-services-gradle-release: ERROR: EXCEPTION: TypeError: arg.slice is not a function
cordova-android-support-gradle-release: Android platform: V7+
cordova-android-support-gradle-release: No custom version found in package.json - using plugin default
cordova-android-play-services-gradle-release: ERROR: EXCEPTION: TypeError: arg.slice is not a function
cordova-android-support-gradle-release: Android platform: V7+
cordova-android-support-gradle-release: No custom version found in package.json - using plugin default

使用它代替BUILD FAILED in 10s 35 actionable tasks: 35 executed { Error: /Users/.../android/platforms/android/gradlew: Command failed with exit code 1 Error output: Note: /Users/..../android/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemCookieManager.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. D8: Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:transformClassesWithMultidexlistForDebug'. > com.android.build.api.transform.TransformException: Error while generating the main dex list: Error while merging dex archives: Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes. Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 10s at ChildProcess.whenDone (/Users/.../android/node_modules/cordova-common/src/superspawn.js:135:23) at ChildProcess.emit (events.js:198:13) at ChildProcess.EventEmitter.emit (domain.js:466:23) at maybeClose (internal/child_process.js:982:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) stderr: 'Note: /..../CordovaLib/src/org/apache/cordova/engine/SystemCookieManager.java uses or overrides a deprecated API.\nNote: Recompile with -Xlint:deprecation for details.\nNote: Some input files use or override a deprecated API.\nNote: Recompile with -Xlint:deprecation for details.\nNote: Some input files use unchecked or unsafe operations.\nNote: Recompile with -Xlint:unchecked for details.\nD8: Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy\n\nFAILURE: Build failed with an exception.\n\n* What went wrong:\nExecution failed for task \':app:transformClassesWithMultidexlistForDebug\'.\n> com.android.build.api.transform.TransformException: Error while generating the main dex list:\n Error while merging dex archives: \n Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.\n Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy\n\n* Try:\nRun with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.\n\n* Get more help at https://help.gradle.org\n\nBUILD FAILED in 10s\n', stdout: '\n> Configure project :app\n+-----------------------------------------------------------------\n| cordova-android-support-gradle-release: 27.+\n+-----------------------------------------------------------------\nCould not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]\nregisterResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)\nCould not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease]\nregisterResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)\n\n> Task :app:preBuild UP-TO-DATE\n> Task :CordovaLib:preBuild UP-TO-DATE\n> Task :CordovaLib:preDebugBuild UP-TO-DATE\n> Task :CordovaLib:checkDebugManifest\n> Task :CordovaLib:processDebugManifest\n> Task :app:preDebugBuild\n> Task :CordovaLib:compileDebugAidl NO-SOURCE\n> Task :app:compileDebugAidl NO-SOURCE\n> Task :CordovaLib:packageDebugRenderscript NO-SOURCE\n> Task :app:compileDebugRenderscript\n> Task :app:checkDebugManifest\n> Task :app:generateDebugBuildConfig\n> Task :app:prepareLintJar\n> Task :app:generateDebugSources\n> Task :CordovaLib:compileDebugRenderscript\n> Task :CordovaLib:generateDebugBuildConfig\n> Task :CordovaLib:generateDebugResValues\n> Task :CordovaLib:generateDebugResources\n> Task :CordovaLib:packageDebugResources\n> Task :CordovaLib:generateDebugRFile\n> Task :CordovaLib:prepareLintJar\n> Task :CordovaLib:generateDebugSources\n> Task :CordovaLib:javaPreCompileDebug\n\n> Task :CordovaLib:compileDebugJavaWithJavac\n\n> Task :CordovaLib:processDebugJavaRes NO-SOURCE\n> Task :CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug\n> Task :app:javaPreCompileDebug\n> Task :app:mainApkListPersistenceDebug\n> Task :app:generateDebugResValues\n> Task :app:generateDebugResources\n\n> Task :app:processDebugGoogleServices\nParsing json file: /Users/../android/platforms/android/app/google-services.json\n\n> Task :app:mergeDebugResources\n> Task :app:createDebugCompatibleScreenManifests\n> Task :app:processDebugManifest\n> Task :app:processDebugResources\n\n> Task :app:compileDebugJavaWithJavac\n\n> Task :app:compileDebugNdk NO-SOURCE\n> Task :app:compileDebugSources\n> Task :app:mergeDebugShaders\n> Task :app:compileDebugShaders\n> Task :app:generateDebugAssets\n> Task :CordovaLib:mergeDebugShaders\n> Task :CordovaLib:compileDebugShaders\n> Task :CordovaLib:generateDebugAssets\n> Task :CordovaLib:packageDebugAssets\n> Task :app:mergeDebugAssets\n> Task :app:validateSigningDebug\n> Task :app:signingConfigWriterDebug\n> Task :app:transformClassesWithDexBuilderForDebug\n\n> Task :app:transformClassesWithMultidexlistForDebug FAILED\n35 actionable tasks: 35 executed\n', code: 1 }

有关使用目标值的示例,请参见http://reagent-project.github.io/。例如,

Example input

(fn [event] (.log js/console (-> event .-target .-value)))