How does the JS in vue refer to the methods method in .vue?

there is a method of refreshing CAPTCHA in methods of login.vue. In another JS, I want to refer to that method of refreshing CAPTCHA. How should I write it?

login.vue file

<template>
  <div class="login-container">
    <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left">
      <h3 class="title"><img src="/static/images/logo.png"></h3>
      <el-form-item prop="username">
        <span class="svg-container">
          <svg-icon icon-class="user" />
        </span>
        <el-input v-model="loginForm.username" name="username" type="text" autocomplete="off" placeholder="" @keyup.enter.native="handleLogin" />
      </el-form-item>
      <el-form-item prop="password">
        <span class="svg-container">
          <svg-icon icon-class="password" />
        </span>
        <el-input
          :type="pwdType"
          v-model="loginForm.password"
          name="password"
          auto-complete="on"
          placeholder="" />
        <span ref="showpwd" class="show-pwd" @click="showPwd" @keyup.enter.native="handleLogin">
          <svg-icon icon-class="eye" />
        </span>
      </el-form-item>
      <el-form-item prop="verifyCode" class="verify">
        <span class="svg-container">
          <svg-icon icon-class="verify" />
        </span>
        <el-input v-model="loginForm.verifyCode" name="verifyCode" type="text" autocomplete="off" placeholder="" oninput="if(value.length > 4)value = value.slice(0, 4)" @keyup.enter.native="handleLogin" />
      </el-form-item>
      <div class="verify-pos"><img :src="verifyUrl" width="100%" alt="" @click="refreshVerify()"></div>
      <el-form-item>
        <el-button :loading="loading" type="primary" style="width:100%;" @click.native.prevent="handleLogin"> </el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import moment from "moment"
export default {
  name: "Login",
  data() {
    const validateUsername = (rule, value, callback) => {
      if (value.length === 0) {
        callback(new Error(""))
      } else {
        callback()
      }
    }
    const validatePass = (rule, value, callback) => {
      if (value.length === 0) {
        callback(new Error(""))
      } else {
        callback()
      }
    }
    const validateVerify = (rule, value, callback) => {
      if (value.length !== 4) {
        callback(new Error(""))
      } else {
        callback()
      }
    }
    return {
      loginForm: {
        username: "",
        password: "",
        verifyCode: ""
      },
      loginRules: {
        username: [{ required: true, trigger: "blur", validator: validateUsername }],
        password: [{ required: true, trigger: "blur", validator: validatePass }],
        verifyCode: [{ required: true, trigger: "blur", validator: validateVerify }]
      },
      verifyUrl: "",
      verifyImg: process.env.BASE_API + "/base/getVerify",
      loading: false,
      pwdType: "password",
      redirect: undefined
    }
  },
  watch: {
    $route: {
      handler: function(route) {
        this.redirect = route.query && route.query.redirect
      },
      immediate: true
    }
  },
  created() {
    this.verifyUrl = this.verifyImg
  },
  methods: {
    refreshVerify() {
      console.log(this.verifyUrl)
      this.verifyUrl = this.verifyImg + "?v=" + moment().unix()
    },

    showPwd: function() {
      if (this.pwdType === "password") {
        this.pwdType = ""
        this.$refs.showpwd.innerHTML = "<svg data-v-c8a70580="" data-v-37dfd6fc="" aria-hidden="true" class="svg-icon"><use data-v-c8a70580="" xlink:href="-sharpicon-eyes"></use></svg>"
      } else {
        this.pwdType = "password"
        this.$refs.showpwd.innerHTML = "<svg data-v-c8a70580="" data-v-37dfd6fc="" aria-hidden="true" class="svg-icon"><use data-v-c8a70580="" xlink:href="-sharpicon-eye"></use></svg>"
      }
    },
    handleLogin() {
      this.$refs.loginForm.validate(valid => {
        if (valid) {
          this.loading = true
          this.$store.dispatch("Login", this.loginForm).then(() => {
            this.loading = false
            this.$router.push({ path: this.redirect || "/" })
          }).catch(() => {
            this.loading = false
          })
        } else {
          console.log("error submit!!")
          return false
        }
      })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss">
$bg:-sharp2d3a4b;
$light_gray:-sharp666;

/* reset element-ui css */
.login-container {
  .el-input {
    display: inline-block;
    height: 47px;
    width: 80%;
    input {
      background: transparent;
      border: 0px;
      -webkit-appearance: none;
      border-radius: 0px;
      padding: 12px 5px 12px 15px;
      color: $light_gray;
      height: 47px;
      &:-webkit-autofill {
        -webkit-box-shadow: 0 0 0px 1000px $bg inset !important;
        -webkit-text-fill-color: -sharpfff !important;
      }
    }
  }
  .el-form-item {
    border: 1px solid -sharpd2d2d2;
    border-radius: 5px;
    color: -sharp454545;
  }
}

</style>

<style rel="stylesheet/scss" lang="scss" scoped>
$bg:-sharpf2f2f2;
$dark_gray:-sharp889aa4;
$light_gray:-sharpeee;
.login-container {
  position: fixed;
  height: 100%;
  width: 100%;
  background-color: $bg;
  .login-form {
    position: absolute;
    left: 0;
    right: 0;
    width: 375px;
    max-width: 100%;
    padding: 35px 35px 15px 35px;
    margin: 120px auto;
    background-color: -sharpfff;
    border-radius: 10px;
  }
  .tips {
    font-size: 14px;
    color: -sharpfff;
    margin-bottom: 10px;
    span {
      &:first-of-type {
        margin-right: 16px;
      }
    }
  }
  .svg-container {
    padding: 6px 5px 6px 15px;
    color: $dark_gray;
    vertical-align: middle;
    width: 30px;
    display: inline-block;
  }
  .title {
    font-size: 26px;
    font-weight: 400;
    color: $light_gray;
    margin: 0px auto 15px auto;
    text-align: center;
    font-weight: bold;
  }
  .show-pwd {
    position: absolute;
    right: 10px;
    top: 7px;
    font-size: 16px;
    color: $dark_gray;
    cursor: pointer;
    user-select: none;
  }
  .verify {
    display: inline-block;
    width: 150px!important;
  }
  .verify .el-input {
    width: 75%;
  }
  .verify-pos {
    display: inline-block;
    width: 150px;
    vertical-align: middle;
  }
  .verify-pos img {
    cursor: pointer;
  }
}
</style>

request.js

// response 
service.interceptors.response.use(
  response => {
    const res = response.data
    if (res.code !== 200) {
      Message({
        message: res.error,
        type: "error",
        duration: 3 * 1000
      })

      if (res.code === 50008 || res.code === 50012 || res.code === 50014) {
        MessageBox.confirm(
          "",
          "",
          {
            confirmButtonText: "",
            cancelButtonText: "",
            type: "warning"
          }
        ).then(() => {
          store.dispatch("FedLogOut").then(() => {
            location.reload()
          })
        })
      }
     /*  */
      return Promise.reject("error")
    } else {
      return response.data
    }
  },
  error => {
    console.log("err" + error)
    Message({
      message: error.error,
      type: "error",
      duration: 3 * 1000
    })
    return Promise.reject(error)
  }
)
Mar.04,2022

extract the js of refreshing CAPTCHA, import it through import, mix it with mixins,
use reference:
VUE project development using mixins


in js import login from'. / login.vue' ; Note that if necessary, you can print the login as a component object, console.log (login) , to see whether the login component has been introduced, and then the login.methods.refreshVerify () call indicates that the refreshVerify function under the login component has been called

if necessary.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c28ec8-32c89.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c28ec8-32c89.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?