在phonegap build config.xml中添加DateTimepicker插件

时间:2014-05-07 12:03:32

标签: cordova windows-phone-8 phonegap-plugins phonegap-build

我已经为

的wp8 phonegap安装了Datetimepicker的插件
$ cordova plugin add https://github.com/leecrossley/cordova-plugin-datetime-picker.git

它在Emulator中的本地机器上运行良好,但是当我将它转换为XAP文件时它不起作用,我不知道如何在phonegap build中的config.xml中添加插件。

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns = "http://www.w3.org/ns/widgets"
    xmlns:gap = "http://phonegap.com/ns/1.0"
    id        = ""
    versionCode=""
    version   = "">
    <name>test</name>
    <description>
    </description>
    <author href="" email="">

    </author>
    <preference name="phonegap-version" value="3.3.0" />
    <preference name="orientation" value="default" />
    <preference name="fullscreen" value="false" />
    <preference name="target-device" value="universal" />
    <preference name="webviewbounce" value="true" />
    <preference name="prerendered-icon" value="true" />
    <preference name="stay-in-webview" value="true" />
    <preference name="ios-statusbarstyle" value="default" />
    <preference name="detect-data-types" value="true" />
    <preference name="exit-on-suspend" value="false" />
    <preference name="show-splash-screen-spinner" value="true" />
    <preference name="auto-hide-splash-screen" value="true" />
    <preference name="EnableViewportScale" value="true" />
    <preference name="MediaPlaybackRequiresUserAction" value="false" />
    <preference name="AllowInlineMediaPlayback" value="false" />
    <preference name="BackupWebStorage" value="cloud" />
    <preference name="TopActivityIndicator" value="gray" />
    <preference name="KeyboardDisplayRequiresUserAction" value="false" />
    <preference name="HideKeyboardFormAccessoryBar" value="false" />
    <preference name="SuppressesIncrementalRendering" value="false" />
    <preference name="android-minSdkVersion" value="7" />
    <preference name="android-installLocation" value="internalOnly" />
    <preference name="SplashScreenDelay" value="5000" />
    <preference name="ErrorUrl" value=""/>
    <preference name="BackgroundColor" value="0x000000"/>
    <preference name="KeepRunning" value="true"/>
    <preference name="DisallowOverscroll" value="false"/>
    <preference name="LoadingDialog" value=","/> 
    <preference name="LoadUrlTimeoutValue" value="20000" />
    <preference name="disable-cursor" value="false" />
    <gap:platform name="android" />
    <gap:platform name="winphone" />
    <gap:plugin name="org.apache.cordova.device"  />
    <gap:plugin name="org.apache.cordova.inappbrowser"  />
    <gap:plugin name="org.apache.cordova.media"  />
    <icon src="img/applogo.png" gap:platform="android" gap:density="ldpi" />
    <icon src="img/applogo.png" gap:platform="android" gap:density="mdpi" />
    <icon src="img/applogo.png" gap:platform="android" gap:density="hdpi" />
    <icon src="img/applogo.png" gap:platform="android" gap:density="xhdpi" />
    <icon src="img/applogo.png" gap:platform="android" gap:density="xxhdpi" />
    <icon src="img/applogo.png" gap:platform="winphone" gap:role="background" />
    <icon src="img/applogo.png" />
    <gap:splash src="img/applogo.png" gap:platform="android" gap:density="ldpi" />
    <gap:splash src="img/applogo.png" gap:platform="android" gap:density="mdpi" />
    <gap:splash src="img/applogo.png" gap:platform="android" gap:density="hdpi" />
    <gap:splash src="img/applogo.png" gap:platform="android" gap:density="xhdpi" />
    <gap:splash src="img/applogo.png" gap:platform="winphone" />
    <gap:splash src="splash.png" />
</widget>

请帮我解决问题

3 个答案:

答案 0 :(得分:0)

必须在Cordova-iOS应用程序的项目文件夹中的config.xml文件的标记下添加插件。

<plugin name="service_name" value="PluginClassName" />

答案 1 :(得分:0)

我和leecrossley谈话,

他说插件没有构建服务

答案 2 :(得分:0)

我问作者这个在我的项目中使用它,

他回答说。

Apologies, there’s no detailed documentation (yet). Something like this would show the date picker when an element with class “date-input” is clicked (untested):

$(".date-input").bind("click", function() {
    datetimepicker.selectDate(function (date) {
        console.log(date);
    });
});

Once the date is selected, the callback function will log the selected date to the console, but you can do whatever with it.

Lee.

您获得的值将是一种奇怪的格式,您必须使用日期对象

来解析它
This code would convert to a JavaScript date object:

date = new Date(parseInt(date, 10));

You can then format the date in any way you want.

我已成功实施,如果您需要任何帮助,请问我!希望这个答案能满足你的问题!