点击按钮,跳转到另一个页面

页面路径
/pages/index/index.vue
/pages/index/detail.vue

<template>
    <view>
       <view class="btn-area">
           <button @tap="goDetail">点击跳转到详情页面</button>
       </view>    
    </view>
</template>

<script>
export default{
	methods:{
		goDetail(){
			uni.navigateTo({
			    url: './detail'
			});
		}
	}
}

</script>

pages.json:

{
    "pages": [{
        "path": "pages/index/index",
        "style": {
            "navigationBarTitleText": "首页"
        }
    }, {
        "path": "pages/index/detail",
        "style": {
            "navigationBarTitleText": "详情"
        }
    }]
}
Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐