HElloworld.vue:
<template>
<div id="cesiumContainer">
</div>
</template>
<script>
export default {
name: 'HelloWorld',
mounted() {
const Cesium = window.Cesium
var viewer = new Cesium.viewer('cesiumContainer')
var scene = viewer.scene
var url = "http://43.139.126.68:8090/iserver/services/3D-fault/rest/realspace"
var promise = scene.addS3MTilesLayerByScp(url, { name: 'test' })
var s3mlayer
Cesium.when(promise, function (layer) {
scene.camera.setView({
destination: Cesium.Cartesian3.fromDegrees(106.453557529491158, 29.476442887855072, 100)
});
s3mlayer = layer
})
$("#query").click(function (evt) {
s3mlayer.setQueryParameter({
url: "http://43.139.126.68:8090/iserver/services/data-fault/rest/data",
dataSourceName: "",
isMerge: true,
keyword: 'SmID',
})
var infoboxContainer = document.getElementById("bubble");
viewer.customInfobox = infoboxContainer
var title = document.getElementById("title");
var des = document.getElementById("des");
viewer.pickEvent.addEventListener(function (feature) {
var ti = Cesium.defaultValue(feature.TYPENAME, '');
var description = Cesium.defaultValue(feature.SMID, '');
title.innerText = ti;
des.innerText = description;
})
})
},
}
</script>
APP.vue
<template>
<div>
<HelloWorld></HelloWorld>
</div>
</template>
<script>
import HelloWorld from './components/HelloWorld.vue'
export default {
name: 'App',
components: {
HelloWorld
}
}
</script>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>模型查看</title>
<link href="./Cesium/Widgets/widgets.css" rel="stylesheet">
<script src="./Cesium/Cesium.js"></script>
<script src="./jquery.min.js"></script>
<script type=" text/javascript" src="./require.min.js" data-main="js/main"></script>
</head>
请问实现模型属性查询时报错,我helloworld组件22行¥ 和evt 报错,而且场景也被我整丢了。