Framework7路由推送状态将完整的url添加到状态

时间:2019-02-10 13:18:46

标签: javascript routing html-framework-7

请帮忙,因为截止日期逼迫我,我对路由感到头疼

var mainView = null,
myApp = new Framework7({
init: false,
theme: 'md',
language: LANG,
name: $('meta[name="copyright"]').attr('content'),

routes: [
],

view: {
    router: true,
    reloadPages: true,
    allowDuplicateUrls: true,

    pushState: true,
    pushStateSeparator: '',
    pushStateRoot: window.location.protocol + '//' + window.location.hostname + '/',
    iosDynamicNavbar: false,
    xhrCache: false,
},
on: {
    init: function(){
        getRoutes(function(routes){
            myApp.routes = routes;

            mainView = myApp.views.create('.view-main', {
                name: 'main',
                main: true
            });

            route(window.location.href);
        });
    }
},

modal: {
    title: $('title').html(),
    buttonOk: 'OK',
    buttonCancel: 'Отмена',
    preloaderTitle: 'Загрузка...',
    closeByOutside: true,
},

smartSelect: {
    openIn: 'picker',
    backText: 'Назад',
    popupCloseText: 'Закрыть',
    pickerCloseText: 'Выбрать',
    searchbar: false,
    backOnSelect: true,
},
panel: {
    swipe: false,
},
lazy: {
    threshold: 50,
    sequential: false,
},
sortable: {
    moveElements: false
},
notification: {
    closeOnClick: true,
    closeIcon: false,
    closeButtonText: 'Закрыть',
},
touch: {
    fastClicks: true
},
statusbar: {
    iosOverlaysWebView: true,
    scrollTopOnClick: true,
},
upscroller: {
    enable: true,
    text : 'К началу'
},
panels3d: {
    enable: true
},
onready: {
    enable: true
},
callback: {
    enable: true,
    numbers: [
        '(063) 756 5555',
        '<a id="callback" href="'+BASE+'feedback" class="item-content close-popover"><div class="item-inner"><div class="item-title"><b>Обратная связь</b></div></div></a>'
    ]
}

我用它来导航

 mainView.router.navigate(url, {
    pushState: true,
    reloadCurrent: true,
    ignoreCache: true,
    force: true,
    });

发生任何路由时,它都会更改为状态

http://www.dsh.local//uk-UA/contacts/http:/www.dsh.local/uk-UA/products

我尝试了许多不同的修复程序。

P.S。我调试使用“ / uk-UA / products”这样的路径进行导航,它100%对应了路线

路线样本

[{path: “/terms/”, url: “./terms”}, {path: “/terms”, url: “./terms”},…]

我尝试使用Domain(完整路径)的url,相对于开头的是/,并且这种类型如上所述。/

该怎么办?

0 个答案:

没有答案
相关问题