修复非箭头函数的this指向问题。

master
vdpAdmin 2022-08-22 23:20:41 +08:00
parent 07c9f5f846
commit 665342ebf8
3 changed files with 5 additions and 5 deletions

View File

@ -90,14 +90,14 @@ export default {
},
initEventHandler() {
this.$on('setFormData', function (newFormData) {
this.$on('setFormData', (newFormData) => {
//console.log('formModel of globalModel----------', this.globalModel.formModel)
if (!this.subFormItemFlag) {
this.setValue(newFormData[this.field.options.name])
}
})
this.$on('field-value-changed', function (values) {
this.$on('field-value-changed', (values) => {
if (!!this.subFormItemFlag) {
let subFormData = this.formModel[this.subFormName]
this.handleOnChangeForSubForm(values[0], values[1], subFormData, this.subFormRowId)
@ -107,7 +107,7 @@ export default {
})
/* 监听重新加载选项事件 */
this.$on('reloadOptionItems', function (widgetNames) {
this.$on('reloadOptionItems', (widgetNames) => {
if ((widgetNames.length === 0) || (widgetNames.indexOf(this.field.options.name) > -1)) {
this.initOptionItems(true)
}

View File

@ -201,7 +201,7 @@
return
}
this.$on('setFormData', function (newFormData) {
this.$on('setFormData', (newFormData) => {
this.initRowIdData(false)
this.initFieldSchemaData()

View File

@ -41,7 +41,7 @@ export const generateCode = function(formJson, codeType= 'vue') {
optionData: {}
},
methods: {
submitForm: function() {
submitForm() {
this.$refs.vFormRef.getFormData().then( function(formData) {
// Form Validation OK
alert( JSON.stringify(formData) )