古有卖炭翁,伐薪烧炭南山中。
今有读书郎,辛勤牧鸭北山坡。
皆为生计所迫耳!
http://123.56.67.147/ts-sdk-platform/
<script>
export default {
//import引入的组件需要注入到对象中才能使用
components: {},
data() {
//这里存放数据
return {
tileset: null,
url: "http://localhost:8888/cesiumdemo/data/teapot/tileset.json",
form: {
lon: 0,
lat: 0,
height: 0,
scaleX: 1,
scaleY: 1,
scaleZ: 1,
heading: 0,
pitch: 0,
roll: 0
},
preForm:{},
originForm: {},
tilesetJson: {}
};
},
//监听属性 类似于data概念
computed: {},
//监控data中的数据变化
watch: {},
//方法集合
methods: {
init() {
this.$nextTick(() => {
this.loaddata();
this.loadJson();
});
},
loadJson() {
Cesium.Resource.fetchJson({
url: this.url
}).then(jsonData => {
this.tilesetJson = jsonData;
});
},
ok() {
},
reset() {
this.form = Cesium.clone(this.originForm, true);
this.ok();
// this.dingwei();
},
dingwei() {
if (this.check()) {
this.t.flyTo();
}
},
check() {
if (!this.t) {
alert("请先加载模型再执行这个操作!");
return false;
}
return true;
},
downJson() {
let newTilesetRootTransformArray = Cesium.Matrix4.pack(
this.tileset.root.transform,
[]
); //矩阵转数组
this.tilesetJson.root.transform = newTilesetRootTransformArray;
let content = JSON.stringify(this.tilesetJson);
this.downLoadText(content);
},
},
//生命周期 - 创建完成(可以访问当前this实例)
created() {},
//生命周期 - 挂载完成(可以访问DOM元素)
mounted() {
this.init();
},
beforeCreate() {}, //生命周期 - 创建之前
beforeMount() {}, //生命周期 - 挂载之前
beforeUpdate() {}, //生命周期 - 更新之前
updated() {}, //生命周期 - 更新之后
beforeDestroy() {}, //生命周期 - 销毁之前
destroyed() {}, //生命周期 - 销毁完成
activated() {} //如果页面有keep-alive缓存功能,这个函数会触发
};
</script>
<style scoped>
.leftpanel {
position: absolute;
left: 10px;
top: 70px;
width: 500px;
margin-bottom: 50px;
background-color: #e6ebee;
overflow-y: auto;
max-height: calc(100% - 120px);
}
.box-card {
margin: 5px;
margin-bottom: 0;
}
.el-from {
background-color: #e6ebee;
}
.leftpanel >>> .el-card__body,
.el-main {
padding: 10px;
}
span {
display: inline-block;
margin-left: 5px;
margin-top: 10px;
font-size: 18px;
}
.bottom {
margin: 0 auto;
text-align: right;
margin: 10px;
}
.el-form-item {
margin-bottom: 0;
}
.main >>> .el-card__body {
padding: 10px;
}
</style>