账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    vue 多个页面跳转
    40
    0

    注册有三个步骤,如图,之前没写过vue项目,想请教一下,要写成三个页面吗?
    我想写在一个页面,通过隐藏显示每一步,但是在一个页面涉及到后退时,就退出了整个注册
    想请教大神有什么好的实现思路~
    图片一直无法上传,放在链接里了
    注册步骤

    ============================华丽丽的分割线=========================================
    谢谢大家的意见,谢谢一楼给了思路,后退的部分,透过判断是否是第一个步,如果不是的话就让step减一,
    如果是的话就整个页面后退

      <template lang="html">
      <div class="register">
        <mt-header>
          <div slot="left">
            <mt-button icon="back" @click="step=step-1" v-if="step!==1"></mt-button>
            <mt-button icon="back" @click="$router.go(-1)" v-else></mt-button>
          </div>
        </mt-header>
        <v-step1 v-show="step===1">
        </v-step1>
        <v-step2 v-show="step===2">
        </v-step2>
        <v-step3 v-show="step===3">
        </v-step3>
        <div class="register">
          还没有账户?<a href="">注册</a>
        </div>
      </div>
    </template>
    
    <script>
      import Step1 from 'components/register/step1.vue'
      import Step2 from 'components/register/step2.vue'
      import Step3 from 'components/register/step3.vue'
      import {
        Toast
      } from 'mint-ui'
      export default {
        components: {
          'v-step1': Step1,
          'v-step2': Step2,
          'v-step3': Step3,
        },
        data() {
          return {
            step: 1
          }
        },
        methods: {
        
        }
      }
    
    </script>
    
    <style lang="less" scoped>
      @import '../assets/fz.less';
    
      .register {
        >section {
          width: 80%;
          margin: 0 auto;
          .form-box {
            .forget {
              margin: 4vw 0 10vw 0;
              text-align: center;
              .fz(font-size, 26);
              color: #b3b3b3;
              a {
                color: @cl;
              }
            }
            .or {
              text-align: center;
              position: relative;
              line-height: 5vw;
              .division {
                display: inline-block;
                width: 38%;
                border-bottom: 1px solid #e8ecef;
                vertical-align: middle;
              }
              .txt-or {
                .fz(font-size, 26);
                display: inline-block;
                color: #b2b2b2;
                width: 20%;
              }
            }
            .wechat {
              line-height: 5vw;
              margin-top: 5vw;
              text-align: center;
              span {
                color: #19d100;
                .fz(font-size, 28);
              }
            }
          }
        }
        .register {
          text-align: center;
          position: absolute;
          bottom: 0;
          width: 100%;
          line-height: 10vw;
          border-top: 1px solid #e8ecef;
          color: #797979;
          .fz(font-size, 26);
          a {
            color: @cl;
            margin-left: 2vw;
          }
        }
      }
    
    </style>
    
    0
    打赏
    收藏
    点击回答
        全部回答
    • 共 0 条
    • ╄→寒冷的冰 普通会员 1楼

      在 Vue 中,你可以使用以下几种方式来实现多个页面之间的跳转:

      1. 使用路由配置:在 main.js 文件中,你可以配置 Vue 路由。你可以使用 router.push() 方法来导航到新的页面。

      ```javascript import Vue from 'vue' import Router from 'vue-router'

      Vue.use(Router)

      export default new Router({ routes: [ { path: '/page1', component: Page1, }, { path: '/page2', component: Page2, }, // 添加更多的路由... ], }) ```

      1. 使用 vue-router 的 Link 组件:你可以在组件的内部使用 Link 组件来跳转到新的页面。Link 组件可以链接到任何 Vue 路由的 URL。

      ```javascript

      ```

      1. 使用 vuex 框架:如果你的项目使用 Vuex,你可以在 Vue 中直接使用 router.push() 方法来导航到新的页面。Vuex 会自动处理路由的切换。

      ```javascript import Vue from 'vue' import Vuex from 'vuex'

      Vue.use(Vuex)

      export default new Vuex.Store({ state: { activePage: 0, }, mutations: { setActivePage(state, index) { state.activePage = index }, }, actions: { goToPage({ commit }) { commit('setActivePage', this.activePage + 1) }, }, }) ```

      以上就是实现多个页面之间跳转的几种方式。你可以根据你的项目需求选择合适的方法。

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部