Comments (9)
Could you add an example for that?
from nprogress.
import nprogress from 'nprogress'
function install (Vue) {
if (this.installed) return
this.installed = true
Object.defineProperty(Vue.prototype, '$nprogress', {
get: function get () { return this.$root._nprogress }
})
Vue.mixin({
beforeCreate: function beforeEach () {
const np = this.$options.nprogress
if (np) {
this._nprogress = np
np.init(this)
if (Vue.http) {
Vue.http.interceptors.push(function (request, next) {
np.inc(0.2)
next(function (response) {
np.done()
return response
})
})
}
const router = this.$options.router
if (router) {
router.beforeEach(function (route, redirect, next) {
np.start()
next()
})
router.afterEach(function () {
np.done()
})
}
}
}
})
}
function NProgress (options) {
this.app = null
this.configure(options || {})
}
NProgress.prototype.init = function (app) {
this.app = app
}
NProgress.install = install
Object.setPrototypeOf(NProgress.prototype, nprogress)
export default NProgress
To:
import nprogress from 'nprogress'
function install (Vue) {
if (this.installed) return
this.installed = true
Object.defineProperty(Vue.prototype, '$nprogress', {
get: function get () { return this.$root._nprogress }
})
Vue.mixin({
beforeCreate: function beforeEach () {
var np = this.$options.nprogress
if (np) {
this._nprogress = np
np.init(this)
if (Vue.http) {
Vue.http.interceptors.push(function (request, next) {
np.inc(0.2)
next(function (response) {
np.done()
return response
})
})
}
var router = this.$options.router
if (router) {
router.beforeEach(function (route, redirect, next) {
np.start()
next()
})
router.afterEach(function () {
np.done()
})
}
}
}
})
}
function NProgress (options) {
this.app = null
this.configure(options || {})
}
NProgress.prototype.init = function (app) {
this.app = app
}
NProgress.install = install
Object.setPrototypeOf(NProgress.prototype, nprogress)
export default NProgress
The reason this is not working is because the node-modules is not getting pulled through the web-pack compiler to convert ES6 to ES5.
from nprogress.
I just checked you other project: Vue Admin
That one is having the same problem in Safari.
from nprogress.
Which version is your safari?
from nprogress.
Version 9.1.2
from nprogress.
Version 10.0.1 (12602.2.14.0.1) is ok.
Could you post a PR? 😀
from nprogress.
May I ask why you don't have any minified versions of your plugins, that are pulled through web pack? That way you also solve the problem for older browsers. Because IE9> also doesn't support it.
from nprogress.
I think this issue will be fixed when building source codes on production with webpack.
from nprogress.
from nprogress.
Related Issues (18)
- 无法使用 HOT 3
- Keep getting cannot find className of null HOT 4
- Set parent does not work! HOT 2
- IE Error Object doesn't support property or method 'assign'
- axios may not be defined as Vue.axios (e.g. when using with Laravel) HOT 1
- Passing config when using .vue HOT 3
- Failed to find '~nprogress/nprogress.css' after use postcss-import HOT 12
- Error in beforeCreate hook: "SyntaxError: missing ) after argument list" HOT 2
- Trouble configuring this and getting it working HOT 1
- Not working at all HOT 7
- Custom calls support
- Can i css for this bar
- [vite] Internal server error: Failed to resolve import "vue-nprogress/src/NprogressContainer" from "src/App.vue". Does the file exist?
- ReferenceError: route is not defined HOT 2
- Progress bar not stopping if route is guarded and redirected HOT 7
- 这个控件不能在android下运行吗? HOT 2
- axios support HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nprogress.