Skip to content
New issue

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

同页面创建表单问题 #2

Closed
shiguanghuxian opened this issue May 3, 2018 · 11 comments
Closed

同页面创建表单问题 #2

shiguanghuxian opened this issue May 3, 2018 · 11 comments
Labels
bug Something isn't working

Comments

@shiguanghuxian
Copy link

我在同一个页面创建多个表单,会出现错误,事件响应最后一个。
并且我不可以在第一个创建的表单的提交事件理再次创建一个表单

@xaboy
Copy link
Owner

xaboy commented May 3, 2018

稍等我看一下,可以把问题代码发出来吗

@shiguanghuxian
Copy link
Author

mounted() {
this.aaa();
// this.bbb();
},
methods: {
aaa() {
var self = this;
let $f = this.$formCreate(this.rules, {
el: "#fff",
onSubmit: function(formData) {
console.log(formData);
// $f.submitStatus({ loading: true });
// if (self.current == 3) {
// self.current = 0;
// } else {
// self.current += 1;
// }
self.current = 1;
// console.log($f)
// $f.destroy();

      self.bbb();
    },
    submitBtn: {
      //按钮类型,可选值为primary、ghost、dashed、text、info、success、warning、error或者不设置
      type: "primary",
      //按钮大小,可选值为large、small、default或者不设置
      size: "large",
      //按钮形状,可选值为circle或者不设置
      shape: undefined,
      //开启后,按钮的长度为 100%
      long: true,
      //设置button原生的type,可选值为button、submit、reset
      htmlType: "button",
      //设置按钮为禁用状态
      disabled: false,
      //设置按钮的图标类型
      icon: "ios-upload",
      //按钮文字提示
      innerText: "1111",
      //设置按钮为加载中状态
      loading: false
    }
  });
},
bbb() {
  var self = this;
  let $f = this.$formCreate(self.rules1, {
    el: "#qqq",
    onSubmit: function(formData) {
      console.log(formData);
      console.log(123);
      // $f.submitStatus({ loading: true });
      // if (self.current == 3) {
      //   self.current = 0;
      // } else {
      //   self.current += 1;
      // }

      self.current = 0;
      // $f.destroy();
      self.aaa();
    },
    submitBtn: {
      //按钮类型,可选值为primary、ghost、dashed、text、info、success、warning、error或者不设置
      type: "primary",
      //按钮大小,可选值为large、small、default或者不设置
      size: "large",
      //按钮形状,可选值为circle或者不设置
      shape: undefined,
      //开启后,按钮的长度为 100%
      long: true,
      //设置button原生的type,可选值为button、submit、reset
      htmlType: "button",
      //设置按钮为禁用状态
      disabled: false,
      //设置按钮的图标类型
      icon: "ios-upload",
      //按钮文字提示
      innerText: "22222",
      //设置按钮为加载中状态
      loading: false
    }
  });
}

}

@shiguanghuxian
Copy link
Author

你可以给我一个在一个vue文件中创建多个表单的示例,这样我方便理解,不胜感激

@xaboy
Copy link
Owner

xaboy commented May 3, 2018

稍等,正在处理bug

@xaboy
Copy link
Owner

xaboy commented May 3, 2018

同一页面生成多个会有冲突,第二个的ref会丢失.正在处理,虽然还没有头绪

@shiguanghuxian
Copy link
Author

好的,谢谢🙏

@xaboy
Copy link
Owner

xaboy commented May 4, 2018

终于找到解决方案了,等着.一会下载一下最新的

@shiguanghuxian
Copy link
Author

好的,谢谢

@xaboy
Copy link
Owner

xaboy commented May 4, 2018

修复了,明天重新clone一下.注意iview升级到2.13.0了

@shiguanghuxian
Copy link
Author

好的,已经测试ok了

@xaboy
Copy link
Owner

xaboy commented May 5, 2018

好,感谢你提出的问题

@xaboy xaboy closed this as completed May 5, 2018
@xaboy xaboy added good first issue Good for newcomers bug Something isn't working and removed good first issue Good for newcomers labels May 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants