当前位置:网站首页>调整svg宽高
调整svg宽高
2022-06-12 08:28:00 【月来better】
svg是从后端数据获取的,拿到svg后将其追加到wechat_qrcode标签中渲染,后端svg显示的宽高是207207不符合UI280280,就需要调整其svg宽高
调整svg宽高一定要结合viewBox使用
<li id="wechat_qrcode" ref="wechat_qrcode"></li>
mounted(){
this.fetchclientqrcode()
}
methods:{
fetchclientqrcode() {
return this.$http
.get(`/api/qrcode`)
.delegateTo(api_request)
.then((res) => {
this.$nextTick(() => {
this.$refs.wechat_qrcode.innerHTML = res.qrcode;
const svg = document.getElementsByClassName("pyqrcode")[0];
svg.setAttribute("width","280");
svg.setAttribute("height","280");
svg.setAttribute("viewBox","0 0 210 210");
});
})
.catch(({
code, message }) => {
throw `获取数据失败:${
this.$t("api." + code)}, 额外信息: ${
this.$t( "api." + typeof message === "string" ? message : JSON.stringify(message) )}`;
})
.delegateTo(this.$snackbar.delegateError);
}
}

边栏推荐
- vm虛擬機中使用NAT模式特別說明
- ctfshow web 1-2
- 千万别把MES只当做工具,不然会错过最重要的东西
- Principle and configuration of MPLS
- MES系统是什么?MES系统的操作流程是怎样?
- (P21-P24)统一的数据初始化方式:列表初始化、使用初始化列表初始化非聚合类型的对象、initializer_lisy模板类的使用
- 只把MES当做工具?看来你错过了最重要的东西
- (p33-p35) lambda expression syntax, precautions for lambda expression, essence of lambda expression
- 【新规划】
- MATLAB image processing - cosine noise removal in image (with code)
猜你喜欢

Model compression | tip 2022 - Distillation position adaptation: spot adaptive knowledge distillation

Why should enterprises implement MES? What are the specific operating procedures?

(P36-P39)右值和右值引用、右值引用的作用以及使用、未定引用类型的推导、右值引用的传递

What should be paid attention to when establishing MES system? What benefits can it bring to the enterprise?

What exactly is APS? You will know after reading the article

Py & go programming skills: logic control to avoid if else

余压监控系统保证火灾发生时消防疏散通道的通畅,为大型高层建筑的安全运行和人民生命财产安全保驾护航

(p15-p16) optimization of the right angle bracket of the template and the default template parameters of the function template

(P25-P26)基于非范围的for循环、基于范围的for循环需要注意的3个细节

FPGA implementation of right and left flipping of 720p image
随机推荐
CMAKE 里PRIVATE、PUBLIC、INTERFACE属性示例详解
(P14)overrid关键字的使用
Centos8 installing MySQL 8.0 (upper)
Lock mechanism in MySQL
MSTP的配置与原理
Introduction to SDI video data stream format (frequency, rate, YUV, EAV, SAV)
Is it really expensive for enterprises to launch MES software?
Instructions spéciales pour l'utilisation du mode nat dans les machines virtuelles VM
对企业来讲,MES设备管理究竟有何妙处?
Installation of Shengxin R package
[dynamic memory management] malloc & calloc and realloc and written test questions and flexible array
JVM learning notes: garbage collection mechanism
FDA reviewers say Moderna covid vaccine is safe and effective for children under 5 years of age
In depth interpretation of 5g key technologies
ctfshow web4
Ankerui motor protector has the functions of overload inverse time limit, overload definite time limit, grounding, starting timeout, leakage, underload, phase failure, locked rotor, etc
MES helps enterprises to transform intelligently and improve the transparency of enterprise production
MES帮助企业智能化改造,提高企业生产透明度
目前MES应用很多,为什么APS排程系统很少,原因何在?
Map the world according to the data of each country (take the global epidemic as an example)