demo.html
1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<div class="weather-form">
<label for="city">城市:</label>
<input id="city" value="上海" />
<a href="javascript:;" onclick="initWeather()">点击初始化天气</a>
</div>
<abbr id="C6AABD36C1A000016ABC1BFFBC731377" data-type="Weather"></abbr>
<style>
.weather-form {
margin: 10px;
}
label, input, a {
display: inline-block;
height: 24px;
line-height: 24px;
vertical-align: middle;
}
input {
padding-left: 7px;
margin: 0;
border: 1px solid #ccc;
outline: none;
}
a {
color: #108ee9;
text-decoration: underline;
}
</style>
<script>
function initWeather () {
var cityInput = document.getElementById("city");
var cityName = cityInput.value;
Mobile_NS.initWeather("C6AABD36C1A000016ABC1BFFBC731377", cityName);
}
/**
* 以下代码为页面插件的初始化,demo效果所需,无需关注
**/
require(["Weather"], function (Weather) {
new Weather({
el: "C6AABD36C1A000016ABC1BFFBC731377",
option: {
city: "上海"
}
}).render();
});
</script>