Vue移动端框架Mint UI教程-跳转新页面(四)

前三节写了vue的移动端框架的入门篇章,今天接着写,今天写的教程其实很简单,在以前的基础上,新建一个界面,而且进行跳转新页面。vue



Vue移动端框架Mint UI教程-搭建环境引入框架(一)
https://www.jianshu.com/p/874e5152b3c5git

Vue移动端框架Mint UI教程-底部导航栏(二)
https://www.jianshu.com/p/56e887cbb660github

Vue移动端框架Mint UI教程-组件的使用(三)
https://www.jianshu.com/p/5ec1e2d2f652框架

1:首先,在pages底下新建一个新的页面fa.vueide


 
5640239-d9be015f8d214667.png
 

在页面里面写一些代码测试

<template>
  <div id="index">
    我是新页面
  </div>
</template>
<style scoped>
  #index{
    display: flex;
    justify-content: center;
    margin-top: 100px;
  }
</style>
<script>
  export default{}
</script>

2:打开index.js文件
将这个新的界面配置到router文件夹下的index.js中去:flex

import Fa from '../pages/fa.vue'
{
      path: '/fa', component: Fa
  }
 
5640239-8e6b08302c8e166d.png
 

3:在当前的页面里面写跳转方法ui

<li><mt-button size="large" @click="go">测试跳转</mt-button></li>

methods: {
go() {
this.$router.push('/fa');//要跳转的界面
},}
 
5640239-5f0331fa1b3261e7.png
 

4:点击测试:能够看到实现的效果。this


 
5640239-4fde1f70dce9db43.gif
相关文章
相关标签/搜索