完成老师的7-4章节的视频后,没有实现老师的页面跳转功能,希望老师能帮忙解决一下,谢谢!
这是app.json中的代码:
{
"pages": [
"pages/index/main"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "加油吧!少年",
"navigationBarTextStyle": "black"
},
"usingComponents": {
"van-button": "vant-weapp/dist/button/index"
}
}
这是main.js中的代码:
import Vue from 'vue'
import App from './App'
import MpvueRouterPatch from 'mpvue-router-patch'
Vue.use(MpvueRouterPatch)
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue(App)
app.$mount()
这是indes.vue中的代码:
<template>
<div>
<span class="msg">Fighting!</span>
<br/>
<van-button type="primary" @click="jump">按钮</van-button>
</div>
</template>
<script>
export default {
method: {
jump () {
this.$router.push('/pages/index/main')
}
}
}
</script>
<style scoped>
.msg {
color: aqua;
font-weight: bold;
font-size: 20px;
}
</style>