zoukankan      html  css  js  c++  java
  • 用v-bind:style时的问题

    今天纠结了挺久一个问题,个人习惯是在HBuilder里先写好前端样式,在放.net去测试数据,但是发现一个问题

    就是一个提示框跟随鼠标移动

    提示框用v-bind:style绑定一个对象

    DIV就是这句

    <div id="tip" v-show="tipshow" v-bind:style="tipstyle" ></div>

    tipstyle:{
                        left:0,
                        top:0,
                    }
    View Code
    move:function(event){
    
                        if(this.tipshow)
                        {
                        this.tipstyle.left=event.clientX+10;
                        this.tipstyle.top=event.clientY;
                        }
                        console.log(this.tipstyle);
                    },
    View Code

    但是放到.net里出现了问题。弄了半天不知道原因

    感觉是HBuilder自动帮我加了‘px’吗

    我在.net改成对象加px就可以了。

    就改成这样

    v-bind:style="{left:ShowPosition.left+'px',top:ShowPosition.top+'px'}"
    View Code

    感觉就是差了个'px'。

  • 相关阅读:
    Men and women can't be 'just friends
    thin-provisioning-tools
    自签名证书
    sqlite manager
    python -m SimpleHTTPServer 80801
    rsa or dsa?
    sl4a
    mtp
    sl4a
    基站记录仪是个啥?
  • 原文地址:https://www.cnblogs.com/long7long/p/10045656.html
Copyright © 2011-2022 走看看