Stomp vue websocket 断线重连。css 边框 四个角。placeholder字体。css渐变色 中间 两边浅。

Stomp

vue websocket 断线重连

在页面切换之后需要主动的将websocket进行断开操作 
在methods中定义websocket函数 
方法一:

 websocket () {

    let ws = new WebSocket('ws://localhost:8080')

    ws.onopen = () => {

       // Web Socket 已连接上,使用send() 方法发送数据

         ws.send('Holle')

         console.log('数据发送中...')

     }

     ws.onmessage = evt => {

       // console.log('数据已接收...')

     }

     ws.onclose = function () {

       // 关闭 websocket

       console.log('连接已关闭...')

     }

      // 路由跳转时结束websocket链接

     this.$router.afterEach(function () {

       ws.close()

     })

    }

方法二:

methods: {

   websocket () {

        let ws = new WebSocket('ws://localhost:8080')

        ws.onopen = () => {

           // Web Socket 已连接上,使用 send() 方法发送数据

              ws.send('Holle')

              console.log('数据发送中...')

         }

         ws.onmessage = evt => {

           // console.log('数据已接收...')

         }

         ws.onclose = function () {

           // 关闭 websocket

           console.log('连接已关闭...')

         }

          // 组件销毁时调用,中断websocket链接

         this.over = () => {

           ws.close()

         }

    }

}, 

beforeDestroy () {

   this.over()

}

==

css-方形边框四角 - Harlem - 博客园

 

怎么修改placeholder字体的css样式 - 喜欢骑车的大冬瓜 - 博客园

placeholder字体大小


css渐变色 中间 两边浅

background-image:linear-gradient(toright,red,yellow,red)

background:-webkit-gradient(linear, 0 0, 0 bottom, from(#ff0000), to(rgba(0, 0, 255, 0.5)));  
==
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yue31313

感谢打赏,继续分享,给您帮忙。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值