有个很关键的点在于,在进行页面跳转之前,需要在Pages.json中添加跳转路径,在我寻找的过程中,我发现很多作者都跳过了这一步

{"path": "pages/tables/BarChar",
"style": {
    "navigationBarTitleText": "uni-app"
}}

然后就是在页面中正常使用,首先是在tamplate中

    <span><button @click="ToBarChar">{{secound}}</button></span>

然后是在script中

    ToBarChar(){
        uni.navigateTo({
            url:'/pages/tables/BarChar'
        })
    }

这样就能实现页面跳转
关键在我看来,这样细分下去的思想很不错,因为有了pages.json这个步骤,就能管理页面,而这也是和我之前在vscode中类似的地方,之前的vscode是使用router进行管理,也很方便。

Last modification:April 18, 2024
If you think my article is useful to you, please feel free to appreciate