<script>
import $ from 'jquery';
function getinfo(){
console.log('info')
window.test();
}
export default {
data() {
return {
data: 'data信息',
}
},
mounted() {
// methods里面定义的方法, 需要赋值给window
window.test= this.test;
},
methods: {
test() {
console.log(data);
},
}
}
</script>
[Vue+JS] The js code in the script in Vue calls the function in the methods
Guess you like
Origin blog.csdn.net/liusuihong919520/article/details/132709076
Recommended
Ranking