美文网首页
微信小程序-项目结构

微信小程序-项目结构

作者: ismyshellyiqi | 来源:发表于2018-03-05 09:59 被阅读0次

1.项目的目录结构


目录结构.png
  • api
    接口的封装,这里使用的是promise
//orderComment.js
import { baseUrl, MSMKAUTH, auth } from './config.js'

export default (order_id,col,rating,preference,textarea) => {
  return new Promise((reslove, reject) => {
    wx.request({
      url: `${baseUrl}/dispatch/comment/`,
      data: {
        order_id,
        col,
        rating,
        preference,
        textarea,
      },
      header: {
        MSMKAUTH: auth,
        'content-type': 'application/x-www-form-urlencoded'
      },
      method: 'post',
      success(res) {
        reslove(res)
      },
      fail(err) {
        reject(err)
      }
    })
  })
}

坑1:微信的请求必须是htttps://...

  • basics
    一些基础的公共组件,例如ListItem, Loading, Tabbar组件等
  • commponets
    组件
  • images
    图片
  • pages
    展示的页面
  • stytes
    css样式,比如一些公用的样式
  • utils
    公用的js方法
  • app.js app.json app.wxss 小程序的入口文件
  • project.config.json 小程序的配置文件
    主要是appid的配置,当然这些在登录开发工具的时候会自然填写


    image.png

相关文章

网友评论

      本文标题:微信小程序-项目结构

      本文链接:https://www.haomeiwen.com/subject/ykbcfftx.html