1、操作数据
<template> <view class="content"> <view @click="renderScript.emitData">获取renderjs数据</view> {{ name }} </view> </template> <script> export default { data() { return { name: '数据' }; }, onl oad() {}, methods: { // 获取renderjs数据 getdata(name) { this.name = name; } } }; </script> <script module="renderScript" lang="renderjs"> export default { data() { return { name: 'renderjs数据' }; }, onl oad() {}, methods: { // 获取renderjs数据 emitData(e,ownerVm) { // 方法一 ownerVm.callMethod('getdata',this.name); // 方法二 // this.$ownerInstance.callMethod('guid',this.name); } } }; </script> <style></style>
2、传值
<view @click="renderScript.emitData($event, 123456)">获取renderjs数据</view> emitData(e,name) { // 方法二 this.$ownerInstance.callMethod('getdata',name); }
标签:callMethod,renderjs,render,uniapp,js,获取,getdata,数据,name From: https://www.cnblogs.com/symlove/p/17463068.html