Skip to content

Commit c90a91f

Browse files
committed
first commit
1 parent 7801067 commit c90a91f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1631
-2
lines changed

.babelrc

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"presets": [
3+
["env", {
4+
"modules": false,
5+
"targets": {
6+
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
7+
}
8+
}],
9+
"stage-2"
10+
],
11+
"plugins": ["transform-vue-jsx", "transform-runtime"],
12+
"env": {
13+
"test": {
14+
"presets": ["env", "stage-2"],
15+
"plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"]
16+
}
17+
}
18+
}

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/build/
2+
/dist/
3+
/*.js

.eslintrc.js

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// https://eslint.org/docs/user-guide/configuring
2+
3+
module.exports = {
4+
root: true,
5+
parserOptions: {
6+
parser: 'babel-eslint'
7+
},
8+
env: {
9+
browser: true,
10+
},
11+
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
12+
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
13+
extends: ['plugin:vue/essential', 'airbnb-base'],
14+
// required to lint *.vue files
15+
plugins: [
16+
'vue'
17+
],
18+
// check if imports actually resolve
19+
settings: {
20+
'import/resolver': {
21+
webpack: {
22+
config: 'build/webpack.base.config.js'
23+
}
24+
}
25+
},
26+
rules: {
27+
// disallow reassignment of function parameters
28+
// disallow parameter object manipulation except for specific exclusions
29+
'no-param-reassign': ['error', {
30+
props: true,
31+
ignorePropertyModificationsFor: [
32+
'state', // for vuex state
33+
'acc', // for reduce accumulators
34+
'e' // for e.returnvalue
35+
]
36+
}],
37+
// allow optionalDependencies
38+
'import/no-extraneous-dependencies': ['error', {
39+
optionalDependencies: ['test/unit/index.js']
40+
}],
41+
// allow debugger during development
42+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
43+
// others
44+
'no-console': 'off',
45+
'semi': [
46+
'error',
47+
'never'
48+
],
49+
'no-new': 'off',
50+
'comma-dangle': [
51+
'error',
52+
'only-multiline'
53+
],
54+
'import/no-webpack-loader-syntax': 'off',
55+
'import/first': 'off',
56+
'linebreak-style'['off', 'windows'],
57+
},
58+
'globals': {
59+
'window': true,
60+
'document': true,
61+
'App': true,
62+
'Page': true,
63+
'Component': true,
64+
'Behavior': true,
65+
'wx': true,
66+
'getCurrentPages': true,
67+
}
68+
}

.github/workflows/nodejs.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Node
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
strategy:
11+
matrix:
12+
node-version: [10.x]
13+
14+
steps:
15+
- uses: actions/checkout@v1
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
- name: npm install, build, and test
21+
run: |
22+
npm install
23+
npm run build:mp
24+
env:
25+
CI: true

.gitignore

+10-2
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ bower_components
2929
# node-waf configuration
3030
.lock-wscript
3131

32-
# Compiled binary addons (http://nodejs.org/api/addons.html)
32+
# Compiled binary addons (https://nodejs.org/api/addons.html)
3333
build/Release
3434

3535
# Dependency directories
3636
node_modules/
3737
jspm_packages/
3838

39-
# Typescript v1 declaration files
39+
# TypeScript v1 declaration files
4040
typings/
4141

4242
# Optional npm cache directory
@@ -57,3 +57,11 @@ typings/
5757
# dotenv environment variables file
5858
.env
5959

60+
# next.js build output
61+
.next
62+
63+
# others
64+
.idea
65+
.DS_Store
66+
package-lock.json
67+
dist

README.md

+115
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,117 @@
11
# miniprogram
22
Go 中文网微信小程序
3+
4+
## vue-kbone
5+
6+
使用 vue 多端开发(小程序和Web),基于 [kbone](https://github.com/wechat-miniprogram/kbone) 的 element 和 render。
7+
* 一键接入,立即使用
8+
* 支持更完整的 vue 语法及特性
9+
* webpack、es6、babel、hot reload、cli、vue-router、vuex,你想要的都有
10+
11+
## 开发
12+
13+
* Web 端:直接浏览器访问 localhost:8080/ 即可看到效果。
14+
15+
```
16+
npm run web
17+
```
18+
19+
* 小程序端:使用开发者工具打开 dist/mp 目录即可。
20+
21+
```
22+
npm run mp
23+
```
24+
25+
## 构建
26+
27+
* Web 端:构建完成会生成 dist/web 目录
28+
29+
```
30+
npm run build
31+
```
32+
33+
* 小程序端:构建完成会生成 dist/mp 目录
34+
35+
```
36+
npm run build:mp
37+
```
38+
39+
## 小程序端打开
40+
41+
需要先进入 dist/mp 目录执行 `npm install` 安装相关的依赖包,然后用开发者工具打开 dist/mp 目录后再进行 npm 构建(关于 npm 构建可[点此查看官方文档](https://developers.weixin.qq.com/miniprogram/dev/devtools/npm.html))。
42+
43+
## 目录说明
44+
45+
此模板 Web 端使用单入口,通过 vue-router + 动态 import 的方式来运行;小程序端则按照业务分拆成多个页面,同属一个业务的页面则通过 vue-router 来组织。
46+
47+
```
48+
├─ build
49+
│ ├─ miniprogram.config.js // mp-webpack-plugin 配置
50+
│ ├─ webpack.base.config.js // Web 端构建基础配置
51+
│ ├─ webpack.dev.config.js // Web 端构建开发环境配置
52+
│ ├─ webpack.mp.config.js // 小程序端构建配置
53+
│ └─ webpack.prod.config.js // Web 端构建生产环境配置
54+
├─ dist
55+
│ ├─ mp // 小程序端目标代码目录,使用微信开发者工具打开,用于生产环境
56+
│ └─ web // web 端编译出的文件,用于生产环境
57+
├─ src
58+
│ ├─ common // 通用组件
59+
│ ├─ mp // 小程序端入口目录
60+
│ │ ├─ home // 小程序端 home 页面
61+
│ │ │ └─ main.mp.js // 小程序端入口文件
62+
│ │ └─ other // 小程序端 other 页面
63+
│ │ └─ main.mp.js // 小程序端入口文件
64+
│ ├─ detail // detail 页面
65+
│ ├─ home // home 页面
66+
│ ├─ list // list 页面
67+
│ ├─ router // vue-router 路由定义
68+
│ ├─ store // vuex 相关目录
69+
│ ├─ App.vue // Web 端入口主视图
70+
│ └─ main.js // Web 端入口文件
71+
└─ index.html // Web 端入口模板
72+
```
73+
74+
## 其他说明
75+
76+
如果要使用 ts,则在 vue 的 script 标签上加上 `lang="ts"`,具体可参考 src/list/Index.vue。如果要使用 reduce-loader,就不能使用 ts,因为 ts 目前没有支持内联 loader。
77+
78+
## License
79+
80+
MIT
81+
82+
83+
84+
# Mina
85+
86+
![Build Status](https://github.com/bbhj/mina/workflows/Node/badge.svg)
87+
88+
> Searching for missing children, and help them come back home.
89+
90+
We are a technical team with love and emotions.
91+
92+
Welcome to join us.
93+
94+
:)
95+
96+
## Kbone Install & Usage
97+
98+
This MiniProgram project in Wechat base on [Tencent Kbone](https://github.com/Tencent/kbone)
99+
100+
## Install & Run
101+
102+
``` bash
103+
104+
npm install -g kbone-cli
105+
106+
// 开发小程序端
107+
npm run mp
108+
109+
// 开发 Web 端
110+
npm run web
111+
112+
// 构建 Web 端
113+
npm run build
114+
```
115+
116+
![Study Golang](/images/studygolang.png)
117+

build/miniprogram.config.js

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/**
2+
* 配置参考:https://wechat-miniprogram.github.io/kbone/docs/config/
3+
*/
4+
5+
module.exports = {
6+
origin: 'https://mina.baobeihuijia.com',
7+
entry: '/',
8+
router: {
9+
home: [
10+
'/(home|index)?',
11+
'/index.html',
12+
'/test/(home|index)',
13+
],
14+
other: [
15+
'/test/list/:id',
16+
'/test/detail/:id',
17+
],
18+
me: [
19+
'/list/:id',
20+
'/detail/:id',
21+
],
22+
},
23+
redirect: {
24+
notFound: 'home',
25+
accessDenied: 'home',
26+
},
27+
generate: {
28+
autoBuildNpm: 'npm',
29+
tabBar: {
30+
color: '#333',
31+
selectedColor: '#EF4431',
32+
backgroundColor: '#ffffff',
33+
list: [{
34+
pageName: 'home',
35+
text: '主页',
36+
iconPath: './imgs/tabs/home.png',
37+
selectedIconPath: './imgs/tabs/home_selected.png'
38+
}, {
39+
pageName: 'me',
40+
text: '我的',
41+
iconPath: './imgs/tabs/me.png',
42+
selectedIconPath: './imgs/tabs/me_selected.png'
43+
}],
44+
},
45+
},
46+
app: {
47+
backgroundTextStyle: 'light',
48+
navigationBarBackgroundColor: '#fff',
49+
navigationBarTitleText: 'Go 中文网',
50+
navigationBarTextStyle: 'black'
51+
},
52+
appExtraConfig: {
53+
sitemapLocation: 'sitemap.json',
54+
},
55+
global: {
56+
share: true,
57+
windowScroll: false,
58+
backgroundColor: '#F7F7F7',
59+
},
60+
pages: {
61+
home: {
62+
enablePullDownRefresh: true,
63+
pullDownRefresh: true,
64+
},
65+
},
66+
optimization: {
67+
domSubTreeLevel: 10,
68+
69+
elementMultiplexing: true,
70+
textMultiplexing: true,
71+
commentMultiplexing: true,
72+
domExtendMultiplexing: true,
73+
74+
styleValueReduce: 5000,
75+
attrValueReduce: 5000,
76+
},
77+
projectConfig: {
78+
projectname: 'mina',
79+
appid: 'wxf7b5556f34553852',
80+
},
81+
}

0 commit comments

Comments
 (0)