通用事件&样式
<text id="text1" class='txt'
@click="onclick"
@longpress="onlongpress"
@appear="onappear"
@disappear="ondisappear">{{content}}
</text>
<!--
通用事件中一般event都默认有三个属性
1、type: 事件名字,如 click
2、target : 触发事件的组件对象
3、timestamp : 事件被触发时的时间戳
4、direction : 触发事件时屏幕的滚动方向,up 或 down -- 在appear和disappear放在可滚动的容器中才有
<input> 和 <switch> 组件目前不支持 click,longpress 事件,用 change 或 input 事件来代替。
-->
文本在android中居中
如果有设置文本组件的高度,则需要填加上line-height
与之匹配,否则会靠上显示
.txt {
text-align: center;
line-height: 300px; -- 此属性和height匹配
height: 300px;
font-size: 60px;
color: red;
border-radius: 20px;
border-color: blue;
border-style: dotted;
border-width: 2px;
margin: 12px;
background-color: aqua;
}
�
<image id="img" class="img"
resize="stretch"
src="https://gw.alicdn.com/tfs/TB1dZ4WowoQMeJjy0FnXXb8gFXa-950-1267.jpg"></image>
.img {
height: 300px;
width: 300px;
/*如果有设置宽高度,但是view自己宽高未铺满父布局,则可以通过align-self来指定位置*/
align-self: center;
}
�
�