NOUISLIDER:自定义工具提示,不会改变价值

时间:2017-12-15 15:33:08

标签: javascript nouislider

是否可以在不修改值的情况下格式化工具提示?显然,这样做会改变到目前为止的价值。

tooltips: [true],
format: {
    from: Number,
    to: function(value) {
       var str_date = todate(arr[value].timestamp);
       return str_date; 
    }
}

我想在工具提示上显示日期,但我仍然需要“更新”代码上的整数值。

1 个答案:

答案 0 :(得分:2)

您可以将格式化程序(到/从)传递到工具提示选项而不是整个滑块。

所以:apply plugin: 'com.android.application' apply plugin: 'io.fabric' repositories { maven { url 'https://maven.fabric.io/public' } maven { url "https://maven.google.com" } } android { compileSdkVersion 26 buildToolsVersion '26.0.2' defaultConfig { applicationId "projectId" minSdkVersion 15 targetSdkVersion 22 versionCode 41 versionName "5.0.5" multiDexEnabled true ndk { abiFilters "armeabi", "armeabi-v7a", "x86", "mips" } signingConfig signingConfigs.config manifestPlaceholders = [onesignal_app_id : OneSignalID, onesignal_google_project_number: "REMOTE"] } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' lintOptions { disable 'MissingTranslation' } signingConfig signingConfigs.config } debug { signingConfig signingConfigs.config minifyEnabled false } } externalNativeBuild { cmake { path "src/main/cpp/CMakeLists.txt" } } productFlavors { } dexOptions { javaMaxHeapSize "4g" } } crashlytics { enableNdk true } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation files('libs/org.apache.http.legacy.jar') implementation files('libs/twitter4j-core-4.0.2.jar') implementation project(':appiraterandroidmaster') implementation project(path: ':vitamio') implementation files('libs/appodeal-2.1.7.jar') implementation files('libs/YouTubeAndroidPlayerApi.jar') implementation files('libs/jdom2-2.0.6.jar') implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') { transitive = true } implementation('com.crashlytics.sdk.android:crashlytics-ndk:2.0.0@aar') { transitive = true } implementation 'com.android.volley:volley:1.0.0' implementation 'com.android.support:support-v13:26.1.0' implementation 'com.android.support:recyclerview-v7:26.1.0' implementation 'com.android.support:cardview-v7:26.1.0' implementation 'com.android.support:design:26.1.0' implementation 'com.google.android.gms:play-services-ads:11.8.0' implementation 'com.google.android.gms:play-services-location:11.8.0' implementation 'com.google.android.gms:play-services-gcm:11.8.0' implementation 'com.google.firebase:firebase-appindexing:11.8.0' implementation 'com.google.firebase:firebase-core:11.8.0' implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1' implementation 'com.facebook.android:facebook-android-sdk:4.27.0' implementation 'com.google.code.gson:gson:2.8.2' implementation 'com.onesignal:OneSignal:3.6.5' implementation 'com.github.bumptech.glide:glide:4.3.1' implementation 'com.squareup.picasso:picasso:2.5.2' implementation 'com.github.rubensousa:gravitysnaphelper:1.3' implementation 'com.android.support:multidex:1.0.2' implementation 'com.github.clans:fab:1.6.4' /*admod mediation*/ implementation 'com.facebook.android:audience-network-sdk:4.26.1' implementation 'com.google.ads.mediation:facebook:4.26.1.0' implementation 'com.applovin:applovin-sdk:7.6.0' implementation 'com.google.ads.mediation:applovin:7.6.0.0' implementation('com.vungle:publisher-sdk-android:5.3.0@aar') { transitive = true } implementation 'com.google.ads.mediation:vungle:5.3.0.0' implementation 'com.inmobi.monetization:inmobi-ads:7.0.0' implementation 'com.google.ads.mediation:inmobi:6.2.4.0' implementation 'com.adcolony:sdk:3.2.1' implementation 'com.android.support:support-annotations:27.0.2' implementation 'com.google.ads.mediation:adcolony:3.2.1.1' // admob mediation end testImplementation 'junit:junit:4.12' implementation files('libs/OneAudience-sdk-release-6.0.0.0.jar') } // ADD THIS AT THE BOTTOM apply plugin: 'com.google.gms.google-services'

文档:https://refreshless.com/nouislider/slider-options/#section-tooltips