美文网首页
Vue调用IOS原生方法

Vue调用IOS原生方法

作者: 渔夫的小黑屋 | 来源:发表于2018-09-13 18:18 被阅读0次
  • vue 代码
<template>
    <div id="share">
        <h1 style="text-align: center;">分享H5</h1>
        <el-button round @click="open">按钮</el-button>
    </div>
</template>
<script>
    export default {
        name: 'share',
        components: {},
        data() {
            return {}
        },
        mounted: function () {
        },
        methods: {
            open() {
                tianbai.inviteShare('11', '22', '33', '44')
                 }
            }
        }
</script>
<style lang="scss">
</style>
  • IOS 代码
self.context =[self.webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
self.context.exceptionHandler = ^(JSContext *context, JSValue *exceptionValue) {
        context.exception = exceptionValue;
        NSLog(@"异常信息:%@", exceptionValue);
};
self.context[@"tianbai"] = self


-(void)inviteShare:(NSString *)shareInfo :(NSString *)content :(NSString *)img :(NSString *)url{
}

相关文章

网友评论

      本文标题:Vue调用IOS原生方法

      本文链接:https://www.haomeiwen.com/subject/cilggftx.html