123456789101112131415161718192021222324252627282930313233343536373839 |
- <template>
- <view ref="grtcVideo" :userId="userId" class="grtc-video"></view>
- </template>
- <script>
- export default {
- props: {
- userId: {
- type: String,
- default: "",
- required: true
- }
- },
- data() {
- return {
- grtcVideo: null
- };
- },
- watch: {
- userId(newVal) {
- if (this.grtcVideo) {
- this.grtcVideo.setAttribute("userId", newVal);
- }
- }
- },
- mounted() {
- this.grtcVideo = this.$refs.grtcVideo;
- uni.$GRTC.play(this.userId);
- }
- };
- </script>
- <style scoped>
- /* 添加样式 */
- .grtc-video {
- /* 根据需求调整样式 */
- }
- </style>
|