vue函数

 mounted () {
      window.testFun = this.testFun;    // 方法赋值给window
 },
 methods: {
 	// vue内部方法
	testFun () {
	
	},
 }

外部js调用

<script>

    function test() {
      testFun();   // 直接通过window方法去调用methods中对应方法
    }

</script>
Logo

前往低代码交流专区

更多推荐