How the vue.compile string template parses the @ click method

let compileStr = Vue.compile(this.templateString)
this.template = compileStr.render
templateString: function (scope) {
      let fun = function () {
        console.log("afe")
      }
      return `
        <div>
          <el-button type="primary" @click="${fun}"></el-button>
          <el-button type="primary"></el-button>
        </div>
      `
    }

fun does not execute after clicking.

if changed to ${fun ()}, there is an error

Invalid handler for event "click": got undefined

is there any way to be able to compile and process, and click to execute fun? correctly What I am using now is to data the fun method

.
Apr.02,2021

`<el-button type="primary" @click="console.log('afe')"></el-button>`

the easiest way is to write the function body of fun directly into @ click.

@ click= "content" will be compiled like this:

</el-button>`

// 
{
  onclick: function () {
    (function fun() {
      console.log('afe')
    })()
  }
}
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-1b3e97f-2c41c.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-1b3e97f-2c41c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?