# 等图片上传完成才允许点击确定

xcooo

# 图片上传组件

 <myUpload @uploaddata="e => form.tempPlateAddress = e"
          @uploadChange="uploadChange"
          :upload_url="form.tempPlateAddress"
           ref="shareImage"
    style="width:100px;height:100px" />
1
2
3
4
5

# 表单提交按钮

<el-button type="primary"
        :disabled="submitAble"
@click="submit()">确 定</el-button>
1
2
3

# 图片监听函数

 uploadChange (e) {
    this.submitAble = true
},
1
2
3

# watch监听

"form.tempPlateAddress"(val) {
    if(val) {
       this.submitAble = false
    }   
 }
1
2
3
4
5

# 表单提交函数

submit () {
    this.$refs.templateRefs.validate(async valid => {
        if (!valid) return
        if (this.submitAble) {
            return
           }
        if (this.isEdit) {
           try {
                const data = Object.assign(this.form, { idthis.templateId })
                await updatePosterTemplate(data)
                this.getTableData()
                this.$message.success('编辑成功')
             } catch (e) {
                    this.$message.error('编辑失败')
            } finally {
                    this.isEdit = false
                }
            } else {
                try {
                    await createPosterTemplate(this.form)
                    this.getTableData()
                    this.$message.success('创建成功')
                } catch (e) {
                    this.$message.error('创建失败')
                } finally {
                }
            }
            this.isEdit = false
            this.dialogVisible = false
            })
        },
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
上次更新: 2021/6/29 上午10:23:29