第一步
在中国天气网根据自己的需要修改配置并生成代码
中国天气网:链接
第二步
<div id="weather-v2-plugin-standard"></div>
第三步
mounted() {
//天气插件配置
window.WIDGET = {
CONFIG: {
layout: 2,
width: "386",
height: "356",
background: 4,
dataColor: "FFFFFF",
backgroundColor: "102047",
borderRadius: 0,
key: "", //放入自己的id
},
};
//引入天气插件
const s = document.createElement("script");
s.type = "text/javascript";
s.src =
"https://apip.weatherdt.com/standard/static/js/weather-standard-common.js?v=2.0";
document.body.appendChild(s);
},