vue使用element-ui组件 通过点击@click 获取到后端的方法

<template>
  <el-dialog :visible.sync="visible" :title="dataForm.training" :close-on-click-modal="false" :close-on-press-escape="false">
    <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px">
      <el-form-item prop="accessRemark" :label="$t('algorithm.accessRemark1')">
        <el-input v-model="dataForm.accessRemark" :placeholder="$t('algorithm.accessRemark2')"></el-input>
      </el-form-item>
      <el-form-item prop="algorithmType" :label="$t('algorithm.algorithmType1')">
        <el-input v-model="dataForm.algorithmType"></el-input>
      </el-form-item>
    </el-form>
    <template slot="footer">
      <el-button @click="visible = false">{{ $t('cancel') }}</el-button>
      <el-button type="primary" @click="training()">{{ $t('confirm1') }}</el-button>
    </template>
  </el-dialog>
</template>

<script>
export default {
  data () {
    return {
      visible: false,
      dataForm: {
        id: '',
        accessRemark: '',
        algorithmType: '',
        trainingURL:'/res/algorithm/training'
      }
    }
  },
  computed: {
    dataRule () {
      return {
        accessRemark: [
          {  required: true, message: this.$t('validate.required'), trigger: 'blur' }
        ],
        algorithmType: [
          { message: this.$t('validate.required'), trigger: 'blur' }
        ]
      }
    }
  },
  methods: {
    init () {
      this.visible = true
      this.$nextTick(() => {
        this.$refs['dataForm'].resetFields()
        if (this.dataForm.id) {
          this.getInfo()
        }
      })
    },
    // 获取信息
    getInfo () {
      this.$http.get(`/res/algorithm/${this.dataForm.id}`).then(({ data: res }) => {
        if (res.code !== 0) {
          return this.$message.error(res.msg)
        }
        this.dataForm = {
          ...this.dataForm,
          ...res.data
        }
      }).catch(() => {})
    },
    training(){
      window.console.log(this.accessRemark)

    }
  }
}
</script>

<style lang="scss">
.mod-res__algorithm {
}
</style>

不知道应该怎么获取

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值