内置组件view & text、路由创建
1.创建页面和路由配置



如创建后访问不到该路径,尝试重新启动

2.uniapp组件开发和PC端开发的不同
div等html标签在H5开发中可以使用,小程序不能使用,需要使用uniapp提供的组件
3.view组件:类似div标签,不过有自己的一些属性
4.text组件:类型span标签
<template>
<view class="demoView" hover-class="demoViewHover" hover-start-time="50" hover-stay-time="100">
hover-class设置按下发生的样式类;
hover-start-time按住后多久出现点击态,单位毫秒
hover-stay-time手指松开后点击态保留时间,单位毫秒
<view class="innerDemoView" hover-stop-propagation>
hover-stop-propagation阻止冒泡,只在我微信小程序生效,其他H5和微信小程序不生效;
</view>
</view>
---
<view class="">
<text selectable>selectable文本是否可选</text>
<text space="emsp">中 文字符空格大小 </text>
<text space="ensp">中 文字符空格一半大小</text>
<text space="nbsp">根 据字体设置的空格大小 </text>
</view>
</template>
<script setup>
</script>
<style lang="scss">
// 使用lang=scss不需要安装,uniapp启动时会自动安装
.demoView {
width: 300px;
height: 300px;
background-color: blue;
}
.innerDemoView {
width: 150px;
height: 150px;
background: #000;
color: #fff;
}
.demoViewHover {
background-color: red;
}
</style>
浙公网安备 33010602011771号