UNPKG

1.23 kBJavaScriptView Raw
1!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):e.nextLevelScroll=o()}(this,function(){"use strict";var e={functional:!0,render:function(e,t){var n=t.children,r=t.data,i=t.props,u=i.target,c=i.scrollFunction,s=i.shouldNavigate,a=void 0!==s&&s,l=i.navigationType,d=void 0===l?"push":l,f=i.tag,v=void 0===f?"div":f,h=t.parent.$router,p=t._ssrNode;return e(v,Object.assign({},r,{on:{click:p||process.server?void 0:function(){(c||o)(u,{shouldNavigate:a,navigationType:d,$router:h})}}}),n)}},o=function(e,o){return new Promise(function(n,r){var i,u,c,s,a,l,d,f,v;return i=o.shouldNavigate,u=o.navigationType,c=o.$router,Promise.resolve(new Promise(function(o,t){return"function"==typeof e?Promise.resolve(e()).then(o,t):o(e)})).then(function(e){try{return(s=e)?(v=document.querySelector(s))?(v.scrollIntoView({behavior:"smooth"}),i&&c&&t(c,s,u),n()):n(console.error("Could not scroll to ".concat(s))):(window.scroll({top:0,behavior:"smooth"}),i&&c&&(a=c.currentRoute,l=a.hash,d=a.fullPath,f=d.replace(l,""),t(c,f,u)),n())}catch(e){return r(e)}},r)})},t=function(e,o,t){e[t](o)};return e});
2//# sourceMappingURL=vue-next-level-scroll.min.js.map