首页 > 解决方案 > how to call vuejs function from seperate javascript function

问题描述

I am trying to call vuejs function from external javascript function,but its not calling, I have given below the code which i am trying.

//below is my vuejs code vu.js

            Ut = {
                    data: function() {
                    },
                    methods: {
                        show() {
                            alert("Succes");
                        }
                    }
                } 

//below is my seperate js file ext.js

  function call(){
            show()
           }

标签: javascriptfunctionvue.js

解决方案


您需要将您的 vue 组件导入到您的ext.js文件中

import Vu from '../vu'

function call(){
 Vu.show()
}

推荐阅读