Browse Source

持有仓位定时器打开

master
luyisha 2 years ago
parent
commit
1915a4794b
  1. 2
      src/views/contract/hold-position.vue
  2. 26
      src/views/contract/index.vue

2
src/views/contract/hold-position.vue

@ -461,7 +461,7 @@ export default {
}, },
newPrice: { newPrice: {
default: 0, default: 0,
type: Number, type: Number|String,
required: false, required: false,
}, },
holdPositionAll: { holdPositionAll: {

26
src/views/contract/index.vue

@ -142,12 +142,12 @@
:newPriceObj="newPriceObj" :newPriceObj="newPriceObj"
:contractOpen="contractOpen" :contractOpen="contractOpen"
@accountInfo="accountInfo = $event" @accountInfo="accountInfo = $event"
@position="holdPosition" @position="getLastHoldPosition"
@getSymbolDetail="symbolDetail=$event" @getSymbolDetail="symbolDetail=$event"
/> />
</div> </div>
<page-bottom <page-bottom
@position="holdPosition" @position="getLastHoldPosition"
@isall=" @isall="
holdPositionAll = $event; holdPositionAll = $event;
holdPosition(); holdPosition();
@ -263,7 +263,8 @@ export default {
this.indexList(); this.indexList();
this._time = setInterval(() => { this._time = setInterval(() => {
if (this.contractOpen) { if (this.contractOpen) {
this.holdPosition();// // mounted holdPosition
// this.holdPosition();
} }
}, 3000); }, 3000);
this.ws.on("open", () => { this.ws.on("open", () => {
@ -279,10 +280,10 @@ export default {
}, },
// //
mounted: function () { mounted: function () {
// created holdPosition
// setInterval(() => { setInterval(() => {
// this.holdPosition(); this.holdPosition();
// }, 2000) }, 2000)
}, },
methods: { methods: {
ispopover1(item){ ispopover1(item){
@ -376,6 +377,17 @@ export default {
// //
setactiveItem(index=0){ setactiveItem(index=0){
this.accountInfo=this.holdPositionList[index] this.accountInfo=this.holdPositionList[index]
},
// 线
getLastHoldPosition(){
let ti = 0,timer=null;
timer = setInterval(()=>{
this.holdPosition();
ti++;
if(ti==3){
clearInterval(timer);
}
}, 1000)
} }
} }
}; };

Loading…
Cancel
Save