SmoothState回调未启动

SmoothState Callbacks not firing

本文关键字:启动 回调 SmoothState      更新时间:2023-09-26

我正在为web应用程序使用SmoothState,但由于某种原因,似乎大多数回调选项根本没有启动。唯一可以通过的回调选项是onStart。

这是我的代码:

    ;(function ($) {
    'use strict';
    var $body    = $('html, body'),
        content  = $('#container').smoothState({
            prefetch: true,
            pageCacheSize: 10,
            debug: true,
            onReady: {
                duration: 0,
                render: function($container, $newContent) {
                    console.log('onReady');
                    $container.html($newContent);
                    window.initPlugins();
                },
            },
            onAfter: {
                render: function($container, $newContent){
                    console.log('onAfter');
                    window.initPlugins();
                }
            },
        }).data('smoothState');
})(jQuery);

我做错什么了吗?

我也有同样的问题(仍然没有解决)。但从文件来看,它应该是(没有渲染):

onAfter: function($container, $newContent) {}