Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeJim authored Jul 5, 2023
0 parents commit 664636f
Show file tree
Hide file tree
Showing 29 changed files with 645 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Eslint config file
* Documentation: https://eslint.org/docs/user-guide/configuring/
* Install the Eslint extension before using this feature.
*/
module.exports = {
env: {
es6: true,
browser: true,
node: true,
},
ecmaFeatures: {
modules: true,
},
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
globals: {
wx: true,
App: true,
Page: true,
getCurrentPages: true,
getApp: true,
Component: true,
requirePlugin: true,
requireMiniProgram: true,
},
// extends: 'eslint:recommended',
rules: {},
}
107 changes: 107 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Wechat miniprogram
miniprogram_npm
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 leejimqiu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Miniprogram Starter
基于 TDesign 小程序组件库的基础模板

## 初始化

```
npm install
```

然后打开微信开发者工具,点击菜单栏 ”工具“ - “构建npm”,即可开启预览。

## 特性

- [x] 支持 LESS (v0.0.1)
- [x] 使用自定义 tabbar (v0.0.1)
- [x] 支持版本检测,并弹窗更新 (v0.0.2)
- [ ] 通过 GitHub Action 自动发布小程序
25 changes: 25 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// app.js
App({
onLaunch() {
const updateManager = wx.getUpdateManager()

updateManager.onCheckForUpdate(function (res) {
// console.log(res.hasUpdate)
})

updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success(res) {
if (res.confirm) {
updateManager.applyUpdate()
}
}
})
})
},
globalData: {
userInfo: null
}
})
35 changes: 35 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"pages": [
"pages/index/index",
"pages/explore/index",
"pages/my/index"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "Weixin",
"navigationBarTextStyle": "black"
},
"tabBar": {
"custom": true,
"color": "#000000",
"selectedColor": "#000000",
"backgroundColor": "#000000",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页"
},
{
"pagePath": "pages/explore/index",
"text": "发现"
},
{
"pagePath": "pages/my/index",
"text": "我的"
}
]
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}
10 changes: 10 additions & 0 deletions app.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**app.wxss**/
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}
45 changes: 45 additions & 0 deletions custom-tab-bar/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

Component({
data: {
value: 'index',
list: [{
icon: 'home',
value: 'index',
label: '首页',
},{
icon: 'control-platform',
value: 'explore',
label: '发现',
}, {
icon: 'user',
value: 'my',
label: '我的'
}]
},
lifetimes: {
ready() {
const pages = getCurrentPages();
const curPage = pages[pages.length - 1];

if (curPage) {
const nameRe = /pages\/(\w+)\/index/.exec(curPage.route);

if (nameRe[1]) {
this.setData({
value: nameRe[1]
})
}
}
}
},
methods: {
handleChange(e) {
const { value } = e.detail;

// this.setData({ value });
wx.switchTab({
url: `/pages/${value}/index`,
})
}
}
})
7 changes: 7 additions & 0 deletions custom-tab-bar/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"component": true,
"usingComponents": {
"t-tab-bar": "tdesign-miniprogram/tab-bar/tab-bar",
"t-tab-bar-item": "tdesign-miniprogram/tab-bar/tab-bar-item"
}
}
1 change: 1 addition & 0 deletions custom-tab-bar/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* custom-tab-bar/index.wxss */
5 changes: 5 additions & 0 deletions custom-tab-bar/index.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<t-tab-bar value="{{value}}" bind:change="handleChange">
<t-tab-bar-item wx:for="{{list}}" wx:key="index" icon="{{item.icon}}" value="{{item.value}}">
{{item.label}}
</t-tab-bar-item>
</t-tab-bar>
40 changes: 40 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "miniprogram-starter",
"version": "0.0.2",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": ["wechat", "miniprogram", "starter"],
"author": "leejim",
"license": "MIT",
"description": "a start-kit for wechat miniprogram powerby TDesign miniprogram",
"dependencies": {
"tdesign-miniprogram": "^0.12.1"
},
"devDependencies": {}
}
Loading

0 comments on commit 664636f

Please sign in to comment.