I can't seem to get the vue router to work with Weex. There don't seem to be many tutorials or good examples either.
I've used the pre packaged setup for Weex which comes with vue router installed but it just doesn't seem to work.
<template>
<div class="wrapper">
<h2>Hello</h2>
<text @click="jump">Categories</text>
<Home/>
</div>
</template>
<script>
import Home from '@/components/Home'
import router from '@/router.js'
export default {
name: 'App',
components: {
Home
},
data () {
return {
logo: 'https://gw.alicdn.com/tfs/TB1yopEdgoQMeJjy1XaXXcSsFXa-640-302.png'
}
},
methods: {
jump () {
router.push('/categories')
alert('categories')
}
}
}
</script>
Here is the router.js file
/* global Vue
rounter.js
*/
import Router from 'vue-router'
import Home from '@/components/Home'
import Categories from '@/components/Categories'
Vue.use(Router)
module.exports = new Router({
// mode: 'abstract',
routes: [
{
path: '/',
name: 'Home',
component: Home
},
{
path: '/categories',
component: Categories,
meta: {
title: 'Categories'
}
}
]
})
On Weex, you need to:
mode: abstract
router.push('/')
in your entry file