We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<div v-if="isShow" class="popup_login"> <div @click="close('formInline')" class="lay_colse">关闭</div> <div class="title title_join">登录</div> <Form class="popup_form" ref="formInline" :model="formInline" :rules="ruleformInline"> <FormItem prop="username"> <Input type="text" v-model="formInline.username" placeholder="请输入您的用户名"></Input> </FormItem> <FormItem prop="password"> <Input type="password" v-model="formInline.password" placeholder="密码"></Input> </FormItem> <FormItem> <Button class="submitButton" type="primary" :loading="LoginLoading" @click.prevent="handleSubmit('formInline')">登录</Button> </FormItem> </Form> </div> <div v-if="isShow" class="login_mask"></div>
<script> export default { name: 'gameindex', props: { isShow: { type: Boolean, default: false }, LoginLoading: { type: Boolean, default: false } }, data() { return { formInline: { username: '', password: '', loading: false }, ruleformInline: { username: [{ required: true, message: "请填写您的用户名", trigger: 'blur' }], password: [{ required: true, message: "请填写密码", trigger: 'blur' }] } } }, methods: { close(name){ this.$refs[name].resetFields(); this.$emit("close"); }, handleSubmit(name){ const self = this; this.$refs[name].validate((valid) => { if(valid) { let params = { "username": self.formInline.username, "password": self.formInline.password } self.$emit("login", params) // 注:有传参哦! } }) } } } </script>
<login-popup :is-show="showLogin" :LoginLoading="LoginLoading" @close="closeLogin" @login="login" ></login-popup>
import LoginPopup from "@/components/popup/login"; export default { name: 'HeaderTop', components: { JoinPopup, LoginPopup }, data() { return { showLogin: false, LoginLoading: false } }, methods: { closeLogin(){ this.showLogin = false; }, login(params){ const self = this; self.LoginLoading = true; AjaxLoginPanel(params).then(res => { if(res.status === 'success'){ self.recordUserInfo(data) let redirect = self.$route.path ? self.$route.path : decodeURIComponent(self.$route.query.redirect || '/ucenter'); self.$router.push({ path: redirect }) self.closeLogin(); }else{ self.$Message.error(res.message) } self.LoginLoading = false; }) }, }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
一、登录/注册组件
1. login.vue 子组件
2. 父组件
The text was updated successfully, but these errors were encountered: