Jelajahi Sumber

全局变量

wangjiawen 4 tahun lalu
induk
melakukan
0fa70c0743
2 mengubah file dengan 11 tambahan dan 4 penghapusan
  1. 9 3
      components/detail/Detail.vue
  2. 2 1
      main.js

+ 9 - 3
components/detail/Detail.vue

@@ -48,8 +48,6 @@ var canvaColumn = null;
 export default {
 	data() {
 		let data = {
-            backStageIp:"192.168.1.104"	,
-			backStagePort:"8082",
 			targetName:"日发电量",
 			targetUnit:"万kwh",
 			pointKey:"HB_GD_KBF_JS_P4_L19_220_CI0136",
@@ -89,7 +87,15 @@ export default {
 		this.getLineServerData();
 	},
 	onReady() {},
-
+	computed:{
+	   backStageIp:function(){
+		   console.log(this.$store.state.wholeSituationBackStageIp);
+		  return this.$store.state.wholeSituationBackStageIp;
+	   }, backStagePort:function(){
+		   console.log(this.$store.state.wholeSituationBackStagePort);
+		  return this.$store.state.wholeSituationBackStagePort;
+	   },
+	},
 	methods: {
 		targetInformation(pointKey,callTargetName,callTargetUnit){
 			this.address = this.getWindPowerStationNameToSessionStorage();

+ 2 - 1
main.js

@@ -5,12 +5,13 @@ Vue.component('cu-custom',cuCustom)
 import sunUiPassword from './sunui-password/sunui-password.vue'
 Vue.component('sunui-password',sunUiPassword);
 Vue.config.productionTip = false
-
+import store from './common/store.js';
 App.mpType = 'app'
 
 import Common from './common/common.js';
 Vue.prototype.common = Common;
 const app = new Vue({
+	 store,
     ...App
 })
 app.$mount()