VUE 绑定的方法如何直接使用外部函数?

2023-07-03 1,028 0

例如我

import {test} from './test.js'

我如何直接在 <el-dialog :before-close= "test(this)"> 中使用

还是必须创建一个中转函数才行

请高手赐教,谢谢!

Vue3:

<template>
  <el-dialog :before-close="test"></el-dialog>
</template>
<script setup>
  import { test } from './test.js'
</script>

Vue2:

<template>
  <el-dialog :before-close="test"></el-dialog>
</template>
<script>
  import { test } from './test.js'
  export default {
    methods: { test }
  }
</script>

回答

相关文章

nuxt2部署静态化和ssr的时候访问首页先报404再出现首页为什么?
`clip-path` 如何绘制圆角平行四边形呢?
多线程wait方法报错?
vue2固定定位该怎么做?
谁有redis实现信号量的代码,希望借鉴一下?
node.js express art-template渲染html页面慢,如何提速?