diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 5760be5..0000000 --- a/.editorconfig +++ /dev/null @@ -1,12 +0,0 @@ -# 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 diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..773a168 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,11 @@ +{ + "printWidth": 120, + "tabWidth": 2, + "useTabs": false, + "semi": true, + "singleQuote": true, + "proseWrap": "preserve", + "arrowParens": "avoid", + "bracketSpacing": true, + "jsxSingleQuote": true +} \ No newline at end of file diff --git a/src/app.config.ts b/src/app.config.ts index d490642..0daa919 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -1,29 +1,26 @@ export default defineAppConfig({ - pages: [ - 'pages/index/index', - 'pages/repair/repair', - 'pages/user/user', - ], + pages: ['pages/index/index', 'pages/repair/repair', 'pages/user/user'], window: { backgroundTextStyle: 'light', navigationBarBackgroundColor: '#fff', navigationBarTitleText: 'WeChat', - navigationBarTextStyle: 'black' + navigationBarTextStyle: 'black', }, tabBar: { + custom: true, list: [ { pagePath: 'pages/index/index', - text: '主页' + text: '主页', }, { pagePath: 'pages/repair/repair', - text: '维修' + text: '维修', }, { pagePath: 'pages/user/user', - text: '我的' - } - ] - } -}) + text: '我的', + }, + ], + }, +}); diff --git a/src/app.ts b/src/app.ts index fdb7da3..b644b4d 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,16 +1,15 @@ -import { PropsWithChildren } from 'react' -import { useLaunch } from '@tarojs/taro' -//import 'taro-ui/dist/style/index.scss' -import './app.scss' +import { PropsWithChildren } from 'react'; +import { useLaunch } from '@tarojs/taro'; +import 'taro-ui/dist/style/index.scss'; +import './app.scss'; function App({ children }: PropsWithChildren) { - useLaunch(() => { - console.log('App launched.') - }) + console.log('App launched.'); + }); // children 是将要会渲染的页面 - return children + return children; } -export default App +export default App; diff --git a/src/pages/index/index.config.ts b/src/pages/index/index.config.ts index cd12ca7..e4ea550 100644 --- a/src/pages/index/index.config.ts +++ b/src/pages/index/index.config.ts @@ -1,4 +1,4 @@ export default definePageConfig({ navigationBarTitleText: '首页', - usingComponents: {} -}) + usingComponents: {}, +}); diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 7a01e2d..6174b23 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -1,23 +1,25 @@ -import { View, Text } from '@tarojs/components' -import './index.scss' -import { Component, ReactNode } from 'react' +import { View, Text } from '@tarojs/components'; +import { Component, ReactNode } from 'react'; +import { AtButton } from 'taro-ui'; +import './index.scss'; class Index extends Component { state = { - msg: "Hello World!" - } + msg: 'Hello World!', + }; onReady() { - console.log("Index is ready"); + console.log('Index is ready'); } render(): ReactNode { return ( + {this.state.msg} - ) + ); } } -export default Index +export default Index; diff --git a/src/pages/repair/repair.config.ts b/src/pages/repair/repair.config.ts index 3b7672d..a9ca517 100644 --- a/src/pages/repair/repair.config.ts +++ b/src/pages/repair/repair.config.ts @@ -1,3 +1,3 @@ export default definePageConfig({ - usingComponents: {}, -}) \ No newline at end of file + usingComponents: {}, +}); diff --git a/src/pages/repair/repair.tsx b/src/pages/repair/repair.tsx index d96552c..9d6d222 100644 --- a/src/pages/repair/repair.tsx +++ b/src/pages/repair/repair.tsx @@ -1,12 +1,12 @@ -import { View, Text } from "@tarojs/components"; -import { Component, ReactNode } from "react"; +import { View, Text } from '@tarojs/components'; +import { Component, ReactNode } from 'react'; export default class RepairPage extends Component { - render(): ReactNode { - return ( - - Repair Page - - ) - } -} \ No newline at end of file + render(): ReactNode { + return ( + + Repair Page + + ); + } +} diff --git a/src/pages/user/user.config.ts b/src/pages/user/user.config.ts index 3b7672d..a9ca517 100644 --- a/src/pages/user/user.config.ts +++ b/src/pages/user/user.config.ts @@ -1,3 +1,3 @@ export default definePageConfig({ - usingComponents: {}, -}) \ No newline at end of file + usingComponents: {}, +}); diff --git a/src/pages/user/user.tsx b/src/pages/user/user.tsx index 415e029..3c4ebcb 100644 --- a/src/pages/user/user.tsx +++ b/src/pages/user/user.tsx @@ -1,12 +1,12 @@ -import { View, Text } from "@tarojs/components"; -import { Component, ReactNode } from "react"; +import { View, Text } from '@tarojs/components'; +import { Component, ReactNode } from 'react'; export default class UserPage extends Component { - render(): ReactNode { - return ( - - User Page - - ) - } -} \ No newline at end of file + render(): ReactNode { + return ( + + User Page + + ); + } +}