帖子
帖子
用户
博客
课程
显示全部楼层
118
帖子
3
勋章
2261
Y币

[App引擎] 用AVM框架的stml页面,执行execScript怎么调用method

[复制链接]
发表于 2022-8-23 17:34:27
本帖最后由 木子阿笨 于 2022-8-23 17:37 编辑

AVM框架有没有跨页面传值的方法,除了父子传值之外,有没有兄弟传值的方法?

var script = "my_invoke();";
api.execScript({
    name: 'recording',
    script: script
});

执行 execScript ,调用 methods 中的my_invoke方法,报错:
[2022-8-23 17:18:32][ERROR] dispatch script failed. ReferenceError: my_invoke is not defined at undefined:1

stml文件部分源码:
<script>
export default {
        name: 'recording',
        apiready() {

        },
        data() {
                return {

                }
        },
        methods: {
                my_invoke() {
                        var lastLocation = api.getStorage('LAST_GPS_LOCATION');
                        console.log('my_invoke');
                },
                openVueTabLayout() {
                        var list = [{name: 'a', Kmtance: 1}, {name: 'b', Kmtance: 3}, {name: 'c', Kmtance: 5}];
                        var max = Math.min.apply(Math, list.map(item => { return item.Kmtance }))
                        console.log('max=' + max);

                        var safeAreaTop = api.systemType === "ios" ? api.safeArea.top : 300;
                        api.openFrame({
                                name: 'inspectHome',
                                url: 'http://192.168.31.14:8080/#/InspectHome',
                                // url: 'https://www**.**',
                                rect: {
                                        x: 0,
                                        y: 0,
                                        w: 'auto',
                                        h: 'auto',
                                        marginTop: 100,
                                },
                        })
                }
        }
}
</script>
380
帖子
4
勋章
6
Y币
可以用api.sendEvent
您需要登录后才可以回帖 登录

本版积分规则