-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6bb7a10
commit 035f818
Showing
21 changed files
with
333 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
extends: ['taro/react'], | ||
rules: { | ||
'react/jsx-uses-react': 'off', | ||
'react/react-in-jsx-scope': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
dist/ | ||
deploy_versions/ | ||
.temp/ | ||
.rn_temp/ | ||
node_modules/ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// babel-preset-taro 更多选项和默认值: | ||
// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md | ||
module.exports = { | ||
presets: [ | ||
[ | ||
'taro', | ||
{ | ||
framework: 'react', | ||
ts: true, | ||
}, | ||
], | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
env: { | ||
NODE_ENV: '"development"', | ||
}, | ||
defineConstants: {}, | ||
mini: {}, | ||
h5: { | ||
esnextModules: ['taro-ui'], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
const config = { | ||
projectName: 'taro-hooks', | ||
date: '2021-6-24', | ||
designWidth: 750, | ||
deviceRatio: { | ||
640: 2.34 / 2, | ||
750: 1, | ||
828: 1.81 / 2, | ||
}, | ||
sourceRoot: 'src', | ||
outputRoot: '../app-dist', | ||
plugins: [], | ||
defineConstants: {}, | ||
copy: { | ||
patterns: [], | ||
options: {}, | ||
}, | ||
framework: 'react', | ||
mini: { | ||
postcss: { | ||
pxtransform: { | ||
enable: true, | ||
config: {}, | ||
}, | ||
url: { | ||
enable: true, | ||
config: { | ||
limit: 1024, // 设定转换尺寸上限 | ||
}, | ||
}, | ||
cssModules: { | ||
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true | ||
config: { | ||
namingPattern: 'module', // 转换模式,取值为 global/module | ||
generateScopedName: '[name]__[local]___[hash:base64:5]', | ||
}, | ||
}, | ||
}, | ||
}, | ||
h5: { | ||
publicPath: '/', | ||
staticDirectory: 'static', | ||
postcss: { | ||
autoprefixer: { | ||
enable: true, | ||
config: {}, | ||
}, | ||
cssModules: { | ||
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true | ||
config: { | ||
namingPattern: 'module', // 转换模式,取值为 global/module | ||
generateScopedName: '[name]__[local]___[hash:base64:5]', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
module.exports = function (merge) { | ||
if (process.env.NODE_ENV === 'development') { | ||
return merge({}, config, require('./dev')); | ||
} | ||
return merge({}, config, require('./prod')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module.exports = { | ||
env: { | ||
NODE_ENV: '"production"', | ||
}, | ||
defineConstants: {}, | ||
mini: {}, | ||
h5: { | ||
/** | ||
* 如果h5端编译后体积过大,可以使用webpack-bundle-analyzer插件对打包体积进行分析。 | ||
* 参考代码如下: | ||
* webpackChain (chain) { | ||
* chain.plugin('analyzer') | ||
* .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, []) | ||
* } | ||
*/ | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"name": "app", | ||
"version": "1.0.0", | ||
"private": true, | ||
"description": "taro-hooks weapp & h5 demo", | ||
"templateInfo": { | ||
"name": "taro-ui", | ||
"typescript": true, | ||
"css": "less" | ||
}, | ||
"scripts": { | ||
"build:weapp": "taro build --type weapp", | ||
"build:swan": "taro build --type swan", | ||
"build:alipay": "taro build --type alipay", | ||
"build:tt": "taro build --type tt", | ||
"build:h5": "taro build --type h5", | ||
"build:rn": "taro build --type rn", | ||
"build:qq": "taro build --type qq", | ||
"build:jd": "taro build --type jd", | ||
"build:quickapp": "taro build --type quickapp", | ||
"dev:weapp": "npm run build:weapp -- --watch", | ||
"dev:swan": "npm run build:swan -- --watch", | ||
"dev:alipay": "npm run build:alipay -- --watch", | ||
"dev:tt": "npm run build:tt -- --watch", | ||
"dev:h5": "npm run build:h5 -- --watch", | ||
"dev:rn": "npm run build:rn -- --watch", | ||
"dev:qq": "npm run build:qq -- --watch", | ||
"dev:jd": "npm run build:jd -- --watch", | ||
"dev:quickapp": "npm run build:quickapp -- --watch" | ||
}, | ||
"browserslist": [ | ||
"last 3 versions", | ||
"Android >= 4.1", | ||
"ios >= 8" | ||
], | ||
"author": "", | ||
"dependencies": { | ||
"@babel/runtime": "^7.7.7", | ||
"@tarojs/cli": "3.2.13", | ||
"@tarojs/components": "3.2.13", | ||
"@tarojs/runtime": "3.2.13", | ||
"@tarojs/taro": "3.2.13", | ||
"lodash": "4.17.15", | ||
"@tarojs/react": "3.2.13", | ||
"react": "^17.0.0", | ||
"react-dom": "^17.0.0", | ||
"taro-ui": "^3.0.0-alpha.3" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.8.0", | ||
"@tarojs/mini-runner": "3.2.13", | ||
"@tarojs/webpack-runner": "3.2.13", | ||
"@types/webpack-env": "^1.13.6", | ||
"babel-preset-taro": "3.2.13", | ||
"eslint": "^6.8.0", | ||
"eslint-config-taro": "3.2.13", | ||
"stylelint": "9.3.0", | ||
"@typescript-eslint/parser": "^4.15.1", | ||
"@typescript-eslint/eslint-plugin": "^4.15.1", | ||
"typescript": "^4.1.0", | ||
"@types/react": "^17.0.2", | ||
"eslint-plugin-react": "^7.8.2", | ||
"eslint-plugin-import": "^2.12.0", | ||
"eslint-plugin-react-hooks": "^4.2.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"miniprogramRoot": "dist/", | ||
"projectname": "app", | ||
"description": "taro-hooks weapp & h5 demo", | ||
"appid": "wx15171eb44c7567ae", | ||
"setting": { | ||
"urlCheck": true, | ||
"es6": false, | ||
"postcss": false, | ||
"preloadBackgroundData": false, | ||
"minified": false, | ||
"newFeature": true, | ||
"autoAudits": false, | ||
"coverView": true, | ||
"showShadowRootInWxmlPanel": false, | ||
"scopeDataCheck": false, | ||
"useCompilerModule": false | ||
}, | ||
"compileType": "miniprogram", | ||
"simulatorType": "wechat", | ||
"simulatorPluginLibVersion": {}, | ||
"condition": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"miniprogramRoot": "./", | ||
"projectname": "app", | ||
"description": "taro-hooks weapp & h5 demo", | ||
"appid": "touristappid", | ||
"setting": { | ||
"urlCheck": true, | ||
"es6": false, | ||
"postcss": false, | ||
"minified": false | ||
}, | ||
"compileType": "miniprogram" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export default { | ||
pages: ['pages/index/index'], | ||
window: { | ||
backgroundTextStyle: 'light', | ||
navigationBarBackgroundColor: '#fff', | ||
navigationBarTitleText: 'WeChat', | ||
navigationBarTextStyle: 'black', | ||
}, | ||
}; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Component } from 'react'; | ||
import './app.less'; | ||
|
||
class App extends Component { | ||
componentDidMount() {} | ||
|
||
componentDidShow() {} | ||
|
||
componentDidHide() {} | ||
|
||
componentDidCatchError() {} | ||
|
||
// this.props.children 是将要会渲染的页面 | ||
render() { | ||
return this.props.children; | ||
} | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"> | ||
<meta content="width=device-width,initial-scale=1,user-scalable=no" name="viewport"> | ||
<meta name="apple-mobile-web-app-capable" content="yes"> | ||
<meta name="apple-touch-fullscreen" content="yes"> | ||
<meta name="format-detection" content="telephone=no,address=no"> | ||
<meta name="apple-mobile-web-app-status-bar-style" content="white"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" > | ||
<title></title> | ||
<script> | ||
!function(x){function w(){var v,u,t,tes,s=x.document,r=s.documentElement,a=r.getBoundingClientRect().width;if(!v&&!u){var n=!!x.navigator.appVersion.match(/AppleWebKit.*Mobile.*/);v=x.devicePixelRatio;tes=x.devicePixelRatio;v=n?v:1,u=1/v}if(a>=640){r.style.fontSize="40px"}else{if(a<=320){r.style.fontSize="20px"}else{r.style.fontSize=a/320*20+"px"}}}x.addEventListener("resize",function(){w()});w()}(window); | ||
</script> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default { | ||
navigationBarTitleText: '首页', | ||
}; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React, { Component } from 'react'; | ||
import { View, Text } from '@tarojs/components'; | ||
import { AtButton } from 'taro-ui'; | ||
|
||
import 'taro-ui/dist/style/components/button.scss'; // 按需引入 | ||
import './index.less'; | ||
|
||
export default class Index extends Component { | ||
componentWillMount() {} | ||
|
||
componentDidMount() {} | ||
|
||
componentWillUnmount() {} | ||
|
||
componentDidShow() {} | ||
|
||
componentDidHide() {} | ||
|
||
render() { | ||
return ( | ||
<View className="index"> | ||
<Text>Hello world!</Text> | ||
<AtButton type="primary">I need Taro UI</AtButton> | ||
<Text>Taro UI 支持 Vue 了吗?</Text> | ||
<AtButton type="primary" circle> | ||
支持 | ||
</AtButton> | ||
<Text>共建?</Text> | ||
<AtButton type="secondary" circle> | ||
来 | ||
</AtButton> | ||
</View> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.