Vue how to dynamically modify the title, '6.66 BTC/USDT', where the price is constantly changing, so how should I implement, do not want to operate DOM.

topic description

I want to dynamically modify the title according to the latest pushed price, but I don"t want to do it. DOM, then how should I implement it?

sources of topics and their own ideas

referring to https://www.hbg.com/zh-cn/coi.
, my previous idea is to get the latest market price and market name when the page is initialized, and then modify the value of Title through document.title. After that, Websocket pushes it once, and changes the value of title once. This is really possible. However, there will be big performance problems

related codes

/ / Please paste the code text below (do not replace the code with pictures)

/**
 * 
 */
getWebsiteConfig:function(data){
    let self = this;
    // 
    self.getWebsiteConfig = data.webTitle;
    //  title (newPricemarketName )
    let title = self.formatFloat(self.newPrice,self.pointRoundPrice) + " " + self.marketName + " | " + self.getWebsiteConfig;
    document.title = title;
},

what result do you expect? What is the error message actually seen?

the result I most expect is to be able to change the value of the title without a DOM operation, following the latest price change.

May.08,2021

vue means you can change data without operating dom. Data-driven view


if you don't operate, other libraries help you operate. Document can't be created dynamically. It must be your own fastest operation.
you say there is a performance problem. Is websocket pushing hundreds of times a second? Then you can stop the river yourself

Menu