height:100%失效解决办法

首先我们要知道height:100%能生效有两种情况。

  • 第一种是父级有显性高度,即写了具体值。当然从html一直往下都赋予height:100%也是属于这种情况。(html=>body=>…=>父级=>目标元素)。

当然设置max-heightmin-heightheight:100%的多数情况是没用的,它们只是设置边界而不是设置具体值。

  • 第二种就是自身绝对定位,父级相对定位,脱离文档流。其实原理和上述是一致的。

Read More

vue-router传递参数3种方法

第一种:get方法

传递值

1
2
3
<router-link :to="{path:'/test',query: { userId: 123,userName:'xia' }}">跳转</router-link>

<router-link :to="{name:'test',query: { userId: 123,userName:'xia' }}">跳转</router-link>

接收值(页面刷新的时候不会消失)

1
2
this.$route.query.userId  // 123
this.$route.query.userName // xia

url上显示参数:http://localhost:8080/test?userId=123&userName=xia

Read More