Bootstrap之旅不起作用._options.storage.getItem

时间:2018-03-03 17:06:42

标签: javascript bootstrap-tour

我的Bootstrap巡演工作正常,但后来我做了一些工作,无法弄清楚我搞砸了哪里。我不能发布git repo,因为它是私有的。 所以我的错误是代码是在你第一次第一次去页面时运行的。我在Chrome控制台中遇到的错误是:

bootstrap-tour.min.js:22 Uncaught TypeError: this._options.storage.getItem is not a function
    at o._getState (bootstrap-tour.min.js:22)
    at o.ended (bootstrap-tour.min.js:22)
    at o.init (bootstrap-tour.min.js:22)
    at main.js:207
    at main.js:212

登录后初始页面加载的代码

if(location.href == 'https://example.com/dashboard'){
    (function(){

        var tour = new Tour({
            storage : true,
             steps: [
            {
              element: ".tour-step.tour-step-one",
              placement: "top",
              title: "Welcome to Phantom AM!",
              content: "This tour will guide you through some of the features we'd like to point out.",
            },
            {
              element: ".tour-step.tour-step-two",
              placement: "bottom",
              title: "Quick Tracker",
              content: "These four boxes show a quick look at what you have tracked so far.",
            },
            {
              element: ".tour-step.tour-step-three",
              placement: "right",
              title: "Add a manufacturer",
              content: "Start by adding a manufacturer.",

            },
            {
              element: ".tour-step.tour-step-four",
              title: "Title of my step",
              content: "Content of my step",
              path: "/dashboard/it/manufacturer/new"
            }
        ]
        });

        // Initialize the tour
        tour.init(); **// error line**

        // Start the tour
        tour.start();

    }()); **// error line**
}

1 个答案:

答案 0 :(得分:0)

更改

storage: true

storage: window.localStorage

您要使用的存储系统。可以是对象window.localStorage,window.sessionStorage或您自己的对象。 您可以将此选项设置为false以禁用存储持久性(每次加载页面时,游览从头开始)。

您可以参考Bootstrap tour pabe的文档

http://bootstraptour.com/api/