0

我的 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**
}
4

1 回答 1

1

改变

storage: true

storage: window.localStorage

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

可以参考 Bootstrap tour pabe 的文档

http://bootstraptour.com/api/

于 2018-03-11T22:11:36.127 回答