uniapp renderjs页面传值
<template>
<view class="content">
<!-- @click="ezuikit.onClick" -->
<view class="preview" id="video-container" :prop="detail" :change:prop="ezuikit.receiveMsg"></view>
</view>
</template>
<script>
import { monitordetail } from "@/api/all.js" // 获取数据的接口
export default {
data() {
return {
detail: { },
};
},
created() {
monitordetail({monitorId: uni.getStorageSync('monitorId')}).then(res=>{
this.detail = {
token: res.data.accessToken,
url: res.data.url
}
})
},
methods: {
// // 接收renderjs发回的数据
// onViewClick(val) {
// console.log('receiveRenderData-->', val);
// }
}
};
</script>
<script module="ezuikit" lang="renderjs">
import { monitordetail } from "@/api/all.js"
var player = null;
export default {
data() {
return {
getData:{}
}
},
mounted() {
},
methods: {
// 接收逻辑层发送的数据
receiveMsg(newValue, oldValue, ownerVm, vm) {
// console.log('newValue', newValue)
// console.log('oldValue', oldValue)
this.getData = newValue
if (typeof window.EZUIKit !== 'undefined') {
this.initPlayer();
} else {
// 动态引入较大类库避免影响页面展示
const script = document.createElement('script')
// view 层的页面运行在 www 根目录,其相对路径相对于 www 计算
script.src = 'static/ezuikit.js'
script.onload = this.initPlayer.bind(this)
document.head.appendChild(script)
}
},
// onClick(event, ownerInstance) {
// // 调用 service 层的方法
// ownerInstance.callMethod('onViewClick', {
// test: 'test'
// })
// },
initPlayer() {
}
}
}
</script>
<style>
.content {
margin-top: 30%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
</style>