简单地使用Vue的扩展方法和 vm.$el
api 实现同步submit。原理就是在html页面插入form表单再调用submit方法。
- Use as vue plugin
import Vue from 'vue'
import syncForm from 'vue-sync-form'
//in vue instance
this.$syncForm.postSync("/path", formData);
- Use as a class
import { syncForm } from "vue-sync-form";
syncForm.postSync("/test", JSON.parse(this.form));
- For more information,please read the sample code, or run the sample with the cmd:
npm run dev