File tree 1 file changed +23
-10
lines changed
1 file changed +23
-10
lines changed Original file line number Diff line number Diff line change @@ -275,16 +275,6 @@ p._match = function (path) {
275
275
this . _vm . $set ( 'route' , context )
276
276
}
277
277
278
- /**
279
- * Installation interface.
280
- * Install the necessary directives.
281
- */
282
-
283
- VueRouter . install = function ( Vue ) {
284
- require ( './view' ) ( Vue )
285
- require ( './link' ) ( Vue )
286
- }
287
-
288
278
/**
289
279
* Set current hash
290
280
*
@@ -301,4 +291,27 @@ function setHash (hash, replace) {
301
291
}
302
292
}
303
293
294
+ /**
295
+ * Installation interface.
296
+ * Install the necessary directives.
297
+ */
298
+
299
+ var installed = false
300
+ VueRouter . install = function ( Vue ) {
301
+ if ( installed ) {
302
+ Vue . util . warn && Vue . util . warn (
303
+ 'vue-router has already been installed.'
304
+ )
305
+ return
306
+ }
307
+ installed = true
308
+ require ( './view' ) ( Vue )
309
+ require ( './link' ) ( Vue )
310
+ }
311
+
312
+ // Auto-install if loaded
313
+ if ( typeof Vue !== 'undefined' ) {
314
+ Vue . use ( VueRouter )
315
+ }
316
+
304
317
module . exports = VueRouter
You can’t perform that action at this time.
0 commit comments