// 我是自定义的js文件
export function shanChuComment(vm) {
// 这个ceshi是在父组件定义的方法,vm是父组件中传过来的this。所以在此页面就能直接用vm代替传过来的this。然后调用父组件内的所有方法
vm.ceshi()
}
<script>
// 引入删除评论方法
import {
shanChuComment
} from "@/utils/onShanchu.js";
</script>
//我是父组件vue页面:
methods: {
ceshi() {
uni.showToast({
title: '测试'
})
}
}