微信小程序学习笔记-1

学习黑马程序员的微信小程序开发教程

项目文件夹

 

1.	pages:存所有小程序页面,以单独文件夹存在,如index、list、list2、logs
这些文件夹中都含有4个基本文件
a)	.js文件:页面脚本文件,存页面数据、事件处理函数等
b)	.json文件:页面配置文件,配置窗口外观、表现等,页面中的配置项会覆盖app.json的window中相同的配置项
如:增加index.json配置
{
  "usingComponents": {},
  "navigationBarBackgroundColor":"#00b26a"
}
c)	.wxml文件:页面模板结构文件
d)	.wxss文件:当前页面样式表文件
2.	utils:存工具性模块,主要为格式化时间模块
3.	app.js:入口文件
4.	app.json:全局配置文件
{
  "pages":[
    "pages/list2/list2",
    "pages/list/list",
    "pages/index/index",
    "pages/logs/logs"
  ],
  "window":{
    "backgroundTextStyle":"light",
    "navigationBarBackgroundColor": "#fff",
    "navigationBarTitleText": "Weixin",
    "navigationBarTextStyle":"black"
  },
  "style": "v2",
  "sitemapLocation": "sitemap.json"
}
a)	pages:记录属于页面路径
b)	window:全局定义所有页面的背景色、文字颜色等
c)	style:全局组件所使用的样式版本
d)	sitemapLocation:指明sitemap.json的位置
5.	app.wxss: 全局样式文件
6.	project.config.json:项目配置文件,对小程序开发工具所做的个性化配置
a)	setting:存编译相关的配置
b)	projectname:存项目名称
c)	appid:存小程序的账号id
{
    "description": "项目配置文件",
    "packOptions": {
        "ignore": [
            {
                "type": "file",
                "value": ".eslintrc.js"
            }
        ]
    },
    "setting": {
        "urlCheck": true,
        "es6": true,
        "enhance": true,
        "postcss": true,
        "preloadBackgroundData": false,
        "minified": true,
        "newFeature": false,
        "coverView": true,
        "nodeModules": false,
        "autoAudits": false,
        "showShadowRootInWxmlPanel": true,
        "scopeDataCheck": false,
        "uglifyFileName": false,
        "checkInvalidKey": true,
        "checkSiteMap": true,
        "uploadWithSourceMap": true,
        "compileHotReLoad": true,
        "lazyloadPlaceholderEnable": false,
        "useMultiFrameRuntime": false,
        "useApiHook": false,
        "useApiHostProcess": false,
        "babelSetting": {
            "ignore": [],
            "disablePlugins": [],
            "outputPath": ""
        },
        "useIsolateContext": false,
        "userConfirmedBundleSwitch": false,
        "packNpmManually": false,
        "packNpmRelationList": [],
        "minifyWXSS": true,
        "disableUseStrict": false,
        "minifyWXML": true,
        "showES6CompileOption": false,
        "useCompilerPlugins": false,
        "ignoreUploadUnusedFiles": true
    },
    "compileType": "miniprogram",
    "libVersion": "2.19.4",
    "appid": "wx06b4431fc1c6e4bf",
    "projectname": "one",
    "debugOptions": {
        "hidedInDevtools": []
    },
    "scripts": {},
    "staticServerOptions": {
        "baseURL": "",
        "servePath": ""
    },
    "isGameTourist": false,
    "condition": {
        "search": {
            "list": []
        },
        "conversation": {
            "list": []
        },
        "game": {
            "list": []
        },
        "plugin": {
            "list": []
        },
        "gamePlugin": {
            "list": []
        },
        "miniprogram": {
            "list": []
        }
    }
}
7.	sitemap.json:配置小程序及其页面是否被微信索引
{
  "desc":"关于本文件的更多信息,请参考文档https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
  "rules": [{
  "action": "allow",
  "page": "*"
  }]
}
a)	action也可为disallow
b)	sitemap的索引提示是默认开启的,如需关闭,可在project.config的setting中配置字段checkSiteMap为false
注:JSON是一种数据格式,总是以配置文件形式出现

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值