q-form-creater
v0.0.12
Published
sprite-nodes-links
Downloads
1
Readme
q-form-creater
import QFormCreater from '../src/index'
const dom = document.querySelector('#app')
// var style = `h3 {color: red}`
var style = '' //可以为链接
var _url = 'http://localhost:8081/m.html#/mobile/index?form_type=4a96a2c3-dbc5-4b77-84b5-9645dd146416&uid=uid=111&user=111_2582461337000&token=8eea71103e2dea44ceac2c33f51d258e&autojump=0'
let qform = new QFormCreater({
container: dom,
url: _url,
style: style
})
document.querySelector('#btn').addEventListener('click', () => {
qform.getFormData('0c0eb791-e35f-43aa-b69c-00f38385fa00').then(ret => {
console.log(ret)
})
// const style = qform.getFormStyle().then(res => console.log(res))
// qform.setFormData({ '41f8a0b6-9b96-4733-bb1f-de7e5e834b4e': '112313' }).then(ret => console.log(ret))
// qform
// .validate()
// .then(ret => console.log('succ', ret))
// .catch(err => console.log(err))
})
document.querySelector('#btn1').addEventListener('click', () => {
qform.validate().then(ret => {
console.log(ret)
})
})
document.querySelector('#btn2').addEventListener('click', () => {
qform.setFormData({ '0c0eb791-e35f-43aa-b69c-00f38385fa00': '选项1' }).then(ret => {
console.log(ret)
})
})
document.querySelector('#btn3').addEventListener('click', () => {
qform.getFormStyle().then(ret => {
console.log(ret)
})
})
qform.on('submit', function(data) {
console.log(data)
})
//_this.submitFormData(beforeData, id, _this)