当前位置:网站首页>直播管理项目
直播管理项目
2022-07-01 09:37:00 【七彩冰淇淋与藕汤】


1.直播封面更改,input type= file样式不可变的决绝方法:将其设为与自定义按钮一样的大小、透明,z-index置于自定义按钮之上
2.直播间链接的复制
<p class="live-link">
直播间链接:{
{ liveRoomInfo.url }}
<img src="@/assets/images/ic_copy.png" alt="" class="live-image"
v-clipboard:copy="liveRoomInfo.url"
v-clipboard:success="onCopy"
v-clipboard:error="onError"
>
</p>
<!--
v-clipboard:copy="liveRoomInfo.url" :待拷贝内容
v-clipboard:success="onCopy" :拷贝成功的回调
v-clipboard:error="onError" :拷贝失败的回调
-->3.文字计数,独立的div块,绝对定位置于input里。文字的计数方式为中文算一个字,两个英文算一个字。
let s="中文zh英文eng"
let reg=/[\u4e00-\u9fa5]/g //匹配全文的中文
let zhLen=s.match(reg).length //4
let len=Math.ceil((s.length+zhLen)/2)4.推流地址的展示和非首次直播默认勾选协议
借助 localStorage进行存储。协议勾选默认长期存储。
推流地址的展示由于不在init网络请求的返回值里,因此也将其存储在localStorage,一是为了避免刷新丢失,二是减少网络请求。

5.橱窗商品的选择,录用父子间消息传递。父传子:props;子传父:自定义事件参数。
父组件将已经选择的商品和全部商品传给子组件,橱窗商品弹窗默认勾选已经选中商品。这里有个坑,即无法将父组件传过来的商品对象直接勾选,而是需要在所有的商品过滤除已选商品,才能实现在此框中的勾选。因为父组件传过来的已选商品对象数组和全部商品对象数组的相对应商品无法直接找到,所以需要重新找。而且勾选的数据可能会发生改变,而父元素传来的数据不可变,因此需要再维护一份选中商品数组。
mounted(){
this.hasSelected.forEach(item=>{ //hasSelected:父传来的已选商品
let goodsIndex=this.shopGoods.findIndex(it=>{ //hasSelected:父传来的全部商品
return it.goodsId===item.goodsId
})
this.selectedGoods.push(this.shopGoods[goodsIndex]) //独立维护一份已选商品,因为props传来的数据不可更改
})
this.toggleSelection(this.selectedGoods) //触发勾选
},难点:
1.子组件中的遮罩层不能覆盖整个窗口
原因:子组件即使设置了position:fixed,也只能覆盖调用它的父组件,因为它是挂载在其上。原本是将遮罩层与其中的内容显示框分离,遮罩层在父组件上,父组件又被全局app调用,后因不符合组件拆分理念,故发现上述问题。
解决方法:在子组件中添加如下代码,将组件挂载到body身上
mounted() {
this.$nextTick(() => {
const body = document.querySelector("body");
if (body.append) {
body.append(this.$el);
} else {
body.appendChild(this.$el);
}
});
},
在vue3中可以使用 teleport,传送门
<teleport to='body'>
<modal/>
</teleport>边栏推荐
- JS prototype trap
- IPv6 learning notes
- Introduction to mt7628k eCos development
- JS rewrite their own functions
- [ESP nanny level tutorial] crazy completion chapter - Case: ws2812 light control system based on Alibaba cloud, applet and Arduino
- OSPF - virtual link details (including configuration commands)
- 富文本实现插值
- Simple load balancing with Nacos
- [video game training] real topic of 2013 video game of infrared optical communication device
- Short circuit operator lazy evaluation
猜你喜欢

Flinkv1.13实现金融反诈骗案例

Swift control encapsulation - paging controller

2.3 【kaggle数据集 - dog breed 举例】数据预处理、重写Dataset、DataLoader读取数据

The market is relatively weak recently
![[video game training] real topic of 2013 video game of infrared optical communication device](/img/ef/c2c45c1c6c24aed0a4e93101047372.png)
[video game training] real topic of 2013 video game of infrared optical communication device

Structure de l'arbre - - - arbre binaire 2 traversée non récursive

电脑USB、HDMI、DP各种接口及速度

nacos服务配置和持久化配置

华为帐号多端协同,打造美好互联生活

Error org apache. catalina. core. StandardContext. FilterStart start filter exception
随机推荐
[ESP nanny level tutorial preview] crazy node JS server - Case: esp8266 + DHT11 +nodejs local service + MySQL database
遇到女司机业余开滴滴,日入500!
Record a redis timeout
吃一个女富豪的瓜。。。
2.2 【pytorch】torchvision.transforms
Implementation and application of queue
Strange, why is the ArrayList initialization capacity size 10?
【电赛训练】红外光通信装置 2013年电赛真题
Simple load balancing with Nacos
How to realize the usage of connecting multiple databases in idel
Log4j log framework
JS scope chain and closure
[pytorch] softmax function
Concept of digital currency
HMS core audio editing service 3D audio technology helps create an immersive auditory feast
微信小程序 webview 禁止页面滚动,同时又不影响业务内overflow的滚动的实现方式
Problems caused by delete and delete[]
NoSQL数据库的安装和使用
韦东山板子编译内核问题解决
樹結構---二叉樹2非遞歸遍曆