美文网首页
framework7-vue ^2.x pushState

framework7-vue ^2.x pushState

作者: forever_youyou | 来源:发表于2018-05-31 09:56 被阅读0次

    以前碰过一点 framework7,昨天试了一下framework7-vue ^2.3.0,在需要将 pushState 设置为 true 时发现之前的用法无效:

    // 1.0 之前
    new Vue({
        el: '#app',
        template: '<app/>',
        // Init Framework7 by passing parameters here
        framework7: {
            root: '#app',
            /* Uncomment to enable Material theme: */
            // material: true,
            routes: Routes,
            pushState: true,
            pushStateSeparator: '#',
            ...
        },
    

    随后找了下 官网文档 有说明,

    // Note that all following parameters can be used in global app parameters under view property to set defaults for all views. For example:
    var app = new Framework7({
      view: {
        iosDynamicNavbar: false,
        xhrCache: false,
      }
    });
    
    TIM截图20180531094847.png

    就是view的属性需要设置在 framework7 对象的view属性上,如下:

    new Vue({
      el: '#app',
      template: '<App/>',
      framework7: {
        id: 'com.it1025.m',
        name: 'framework7-vue-demo',
        theme: 'ios', // auto, ios, material
        view: {  // 注意这里 pushState 是 view 的属性,直接是直接挂在 framework7 上
          pushState: true,
          pushStateSeparator: '#',
        },
        routes: Routes
      },
      // router,
      components: {App}
    });
    

    之后 pushState 就有效了:


    TIM截图20180531095505.png

    相关文章

      网友评论

          本文标题:framework7-vue ^2.x pushState

          本文链接:https://www.haomeiwen.com/subject/rwgfsftx.html