Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

使用 button 类型的组件 click 事件中如何获取formdata #27

Closed
shixiaoliu opened this issue Mar 17, 2020 · 3 comments
Closed

Comments

@shixiaoliu
Copy link

formDesc: {
btn: {
label: '自定义',
type: 'button',
title: '按钮文字', // 按钮文字内容
// 或者 title: '按钮文字'
on: {
// 按钮事件触发
click () {
console.log('clicked')
// 这边如何获取 formdata 的值
}
}
}
}

@shixiaoliu
Copy link
Author

额。。。 想到了
data(){
const _this = this
return (
btn:{
on: {
click() {
console.log(_this.formData.phone)
}
}
}
)
}

@dream2023
Copy link
Owner

你这方法有些过时了,箭头函数就行了

click: () => {
	this. formData.phone
}

@shixiaoliu
Copy link
Author

多谢

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants