console
const vue = new Vue({
el: '#vue',
data:{
longitude: '',
latitude:'',
result:{longitude:'xx',latitude:'xx'}
},
methods:{
trans(){
[this.result.latitude,this.result.longitude] = gcoord.transform(
[this.latitude, this.longitude],
gcoord.WGS84,
gcoord.BD09
);
}
}
});
<div id="vue">
<input id="lon" type="text" v-model="longitude" placeholder="经度(longitude)"/>
<input id="lat" type="text" v-model="latitude" placeholder="纬度(lattitude)"/>
<button @click="trans()">转换</button>
<div>经度:<a class="longitude" v-html="result.longitude"></a></div>
<div>纬度:<a class="latitude">{{result.latitude}}</a></div>
</div>
#vue{
input{
display:block;
width:300px;
line-height:2em;
padding-left:1em;
margin-bottom:30px;
}
}