当前位置:网站首页>调整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);
}
}

边栏推荐
- 【新规划】
- MPLS的原理与配置
- (p27-p32) callable object, callable object wrapper, callable object binder
- Hands on learning and deep learning -- simple implementation of linear regression
- What scheduling rules does the APS software have? What is the exception handling scheme?
- Project sorting of niuke.com
- ctfshow web4
- Call method and apply method
- What is the difference between ERP production management and MES management system?
- Calling stored procedures in mysql, definition of variables,
猜你喜欢

ctfshow web 1-2

Hands on deep learning -- activation function and code implementation of multi-layer perceptron

Hands on deep learning 18 -- model selection + over fitting and under fitting and code implementation

Face recognition using BP neural network of NNET in R language

Error: clear the history in the search box in the website?

JVM学习笔记:垃圾回收机制

ASP. Net project development practice introduction_ Item VI_ Error report (summary of difficult problems when writing the project)

(p19-p20) delegate constructor (proxy constructor) and inheritance constructor (using)

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

(P19-P20)委托构造函数(代理构造函数)和继承构造函数(使用using)
随机推荐
【指針進階三】實現C語言快排函數qsort&回調函數
数据库基础——规范化、关系模式
The era of post MES system has come gradually
(p15-p16) optimization of the right angle bracket of the template and the default template parameters of the function template
MATLAB image processing - cosine noise removal in image (with code)
Centso8 installing mysql8.0 (Part 2)
Callback webrtc underlying logs to the application layer
Scope of bean
At present, MES is widely used. Why are there few APS scheduling systems? Why?
Instructions spéciales pour l'utilisation du mode nat dans les machines virtuelles VM
ctfshow web4
Learning notes (1): live broadcast by Dr. Lu Qi - face up to challenges and grasp entrepreneurial innovation opportunities - face up to challenges and grasp entrepreneurial innovation opportunities -1
Arrays in JS
建立MES系统,需要注意什么?能给企业带来什么好处?
只把MES当做工具?看来你错过了最重要的东西
GTEST/GMOCK介绍与实战
Where does the driving force of MES system come from? What problems should be paid attention to in model selection?
Vision transformer | arXiv 2205 - TRT vit vision transformer for tensorrt
FPGA implementation of right and left flipping of 720p image
What exactly is APS? You will know after reading the article