Skip to content

Commit

Permalink
Removing computed property
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Gore committed Oct 20, 2017
1 parent 1876d30 commit 9f6c7f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
14 changes: 5 additions & 9 deletions app.js
@@ -1,19 +1,15 @@
import BooksPage from './pages/BooksPage.js';

new Vue({
el: '#app',
data: {
route: '/pages/BooksPage.js'
page: BooksPage
},
methods: {
navigate(event) {
this.route = event.target.pathname;
}
},
computed: {
page() {
//console.log(this.route); // Uncomment this and it works
return () => import(
this.page = () => import(
/* webpackChunkName: "pages/[request]" */
`./pages/${this.route.split('/').pop()}`
`./pages/${event.target.pathname.split('/').pop()}`
);
}
}
Expand Down
3 changes: 2 additions & 1 deletion index.html
Expand Up @@ -16,12 +16,13 @@
</body>
<script type="text/javascript">
var script = document.createElement('script');
script.type = 'text/javascript';
try {
Function('import("")');
script.src= "app.js";
script.type = 'module';
} catch(e) {
script.src= "dist/build.js";
script.type = 'text/javascript';
}
document.body.appendChild(script);
</script>
Expand Down

0 comments on commit 9f6c7f4

Please sign in to comment.