Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support overriding of vue-page require #3

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,10 @@ module.exports = {
}
```

This component declaration is comming directly from vue-webpack-example.
This component declaration is comming directly from vue-webpack-example.

If vue-page is used as a npm module the viewsPath will be relative to the vue-page module location. If you want viewsPath to be relative to the current file you can add the following attribute

```javascript
require: require
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"license": "MIT",
"devDependencies": {},
"dependencies": {
"page": "^1.4.1"
"page": "^1.6.1"
},
"repository": {
"type": "git",
Expand Down
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
var page = require('page');

exports.install = function (Vue, args) {
Vue.prototype.$navigate = function (path) {
page(path);
};
var Router = Vue.extend({
created: function () {
if (args.default) {
Expand Down Expand Up @@ -44,7 +47,8 @@ exports.install = function (Vue, args) {
}

if (args.viewsPath) {
var path = args.viewsPath + component + '/index.js';
var path = args.viewsPath + component + '/index';
var require = args.require ? args.require : require;
Vue.component(component, require(path));
}

Expand Down Expand Up @@ -82,6 +86,7 @@ exports.install = function (Vue, args) {
currentView: null,
context: null
}

});

if (!args.cssTransitions) {
Expand Down