当前位置:网站首页>uni-app项目目录、文件作用介绍 及 开发规范
uni-app项目目录、文件作用介绍 及 开发规范
2022-07-28 10:08:00 【我那个果味】
一、uni-app 小程序项目目录及文件作用介绍

目录:
1---pages :所有的页面存放目录
2---static: 静态资源目录,例如图片等
3---uni_modules:是uni-app的插件模块化规范(HBuilderX 3.1.0+支持),通常是对一组js sdk、组件、页面、uniCloud云函数、公共模块等的封装,用于嵌入到uni-app项目中使用,也支持直接封装为项目模板。
4---unpackage 就是打包目录,在这里有各个平台的打包文件
文件:
1---App.vue:是我们的根组件,所有页面都是在App.vue下进行切换的,是页面入口文件,可以调用应用的生命周期函数。
2---index.html:基础模板入口文件
3---main.js是我们的项目入口文件,主要作用是初始化vue实例并使用需要的插件。
4---manifest.json 文件是应用的配置文件,用于指定应用的名称、图标、权限等。
5---pages.json 文件用来对 uni-app 进行全局配置,决定页面文件的路径、窗口样式、原生的导航栏、底部的原生tabbar 等
6---uni.scss文件的用途是为了方便整体控制应用的风格。比如按钮颜色、边框风格, uni.scss文件里预置了一批scss变量预置。
二、Vue 单文件组件 (SFC) 规范
<template> </template>里写写页面UI
<template>
//<template> 下只能且必须有一个根 <view> 组件。
<view >
</view>
</template><script> </script>里写一些JS的业务流程代码
<script>
//写一些js业务流程代码
export default{
//data写数据
data(){
return{
userData:{
phone:'',
pwd:''
},
}
},
//methods:里面写功能 方法
methods:{
//登录按钮点击事件
dologin(){
//console.log("我被点击啦!!!");
//console.log(this.userData.phone);
//console.log(this.userData.pwd);
uni.request({
url: '接口地址'
success: (res) => {//请求成功(res参数)
console.log(res.data);
if(res.data.code == 200){
//登录成功
uni.redirectTo({//关闭当前页面跳转URL:页面
url:'../main/mian'
});
}else {
this.open() //登录失败
}
}
});
}
}
}
</script><style> </style>里写css样式
对应引用样式表class="input_str"
<style>
.input_str{
border: 1px solid #000000;
border-radius: 5rpx;
height: 30rpx;
padding: 10rpx;
margin-bottom: 15rpx;
}
</style>边栏推荐
猜你喜欢

Aqua Data Studio 18.5.0导出insert语句

It's settled! On July 30!

Thinking and summary of technical personnel | R & D Efficiency

ADVANCE.AI出海指南助力企业出海印尼,掌握东南亚市场半边天

【微信小程序】项目实战—抽签应用
![[esp32][esp idf][lvgl7.9] failed to compile with OLED IIC](/img/16/e5aa43df6ef9bdbc173fa547c85559.png)
[esp32][esp idf][lvgl7.9] failed to compile with OLED IIC
![[openharmony] [rk2206] build openharmony compiler (2)](/img/0c/2e8290403d64ec43d192969f776724.png)
[openharmony] [rk2206] build openharmony compiler (2)

Skillfully use NGX_ Lua makes traffic grouping

记录一次idea中的父子项目修改project与module名称,亲测!

11、链表反转
随机推荐
Lucene 查询语法备忘
Prometheus operation and maintenance tool promtool (IV) TSDB function
Choosing a supplier service system is the first step for large health industry enterprises to move towards digital transformation
【微信小程序】项目实战—抽签应用
Why should I take the first-class constructor examination? How high is the gold content of the first-class Constructor Certificate?
Oracle中的小知识
11、链表反转
LIBCMTD.lib
ES (8.1) certification topic
中兴通讯总裁徐子阳:5nm芯片将在2021年推出
6. Double pointer -- the sum of the two numbers of the incremental array is equal to the target number
【云驻共创】华为云:MetaStudio数字内容生产线,让虚拟世界与现实世界无缝融合
It's settled! On July 30!
15、判断二维数组中是否存在目标值
13 probability distributions that must be understood in deep learning
5、动态规划---斐波那契数列
[esp32][esp idf] ap+sta realizes wireless bridging and transferring WiFi signals
API 网关 APISIX 在Google Cloud T2A 和 T2D 的性能测试
Guangzhou metro line 14 xinshixu station is under construction, and residents in Baiyun District are about to start a double line transfer mode!
头文件库文件