javascript - 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()
}
解决方案
您需要将您的 vue 组件导入到您的ext.js
文件中
import Vu from '../vu'
function call(){
Vu.show()
}
推荐阅读
- c# - 在 Umbraco 中创建语言镜像站点
- jmeter - 在 Jmeter 中确定协议
- r - 通过平均将每日数据聚合到每周
- android - 卡在预捕获序列中
- graphql - Apollo GraphQL 查询用其他查询覆盖子元素数组
- android - 将 java 变量从 javacode 传递到 react-native 中的 javascript 代码
- node.js - 发送组件作为对 POST 请求的响应
- node.js - 在 mongodb 聚合方法顺序未维护
- android - 自动生成 Android 风格的 google-services.json
- python - sqlalchemy 更新部分日期