diff --git a/README.md b/README.md index ad370f6..01610ff 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,73 @@

- 茶址 + 茶址

- 使用Unibest开发,版本号3.8.2 -
\ No newline at end of file + 使用Unibest开发,版本号3.8.2 + + +
开发规范
+1. 页面或组件添加方法的时候前面加上handle关键字 + handleConfirmHour: () => { + if (totalHour.value <= 0) { + toast.info('至少起订N小时') + return + } + showReservePopup.value = false + }, +2. 页面或组件传创建的方法需要以当前文件名称作为对象按照驼峰命名 + const detail = { + handleConfirmHour: () => { + if (totalHour.value <= 0) { + toast.info('至少起订N小时') + return + } + showReservePopup.value = false + } + } +3. 页面或组件传创建的内部方法需要放在函数最下面,这种方法前面不需要加上handle + const detail = { + handleConfirmHour: () => { + if (totalHour.value <= 0) { + toast.info('至少起订N小时') + return + } + showReservePopup.value = false + }, + + // 格式化时间 + formatDate: (timestamp: number) => { + const date = new Date(timestamp) + const year = date.getFullYear() + const month = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + const hour = String(date.getHours()).padStart(2, '0') + const minute = String(date.getMinutes()).padStart(2, '0') + + return `${year}-${month}-${day} ${hour}:${minute}` + } + } +4. 如果组件名称与定义的对象函数名冲突,则对象函数名后面加上s + import coupon from '@/components/coupon/coupon.vue' + const coupons = { + handleConfirmHour: () => { + if (totalHour.value <= 0) { + toast.info('至少起订N小时') + return + } + showReservePopup.value = false + }, + + // 格式化时间 + formatDate: (timestamp: number) => { + const date = new Date(timestamp) + const year = date.getFullYear() + const month = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + const hour = String(date.getHours()).padStart(2, '0') + const minute = String(date.getMinutes()).padStart(2, '0') + + return `${year}-${month}-${day} ${hour}:${minute}` + } + } \ No newline at end of file diff --git a/src/bundle/coupon/coupon.vue b/src/bundle/coupon/coupon.vue new file mode 100644 index 0000000..c8dbc8a --- /dev/null +++ b/src/bundle/coupon/coupon.vue @@ -0,0 +1,158 @@ + +{ + "layout": "default", + "style": { + "navigationStyle": "custom" + } +} + + + + + + + diff --git a/src/pages-sub/demo/components/request.vue b/src/bundle/demo/components/request.vue similarity index 100% rename from src/pages-sub/demo/components/request.vue rename to src/bundle/demo/components/request.vue diff --git a/src/pages-sub/demo/index.vue b/src/bundle/demo/index.vue similarity index 91% rename from src/pages-sub/demo/index.vue rename to src/bundle/demo/index.vue index 1d6abdd..1d09d9b 100644 --- a/src/pages-sub/demo/index.vue +++ b/src/bundle/demo/index.vue @@ -15,7 +15,7 @@ import RequestComp from './components/request.vue' diff --git a/src/components/coupon/group-coupon.vue b/src/components/coupon/group-coupon.vue index e69de29..8cfaa22 100644 --- a/src/components/coupon/group-coupon.vue +++ b/src/components/coupon/group-coupon.vue @@ -0,0 +1,44 @@ + + + + + + + + diff --git a/src/components/navbar.vue b/src/components/navbar.vue index 360543c..5fddbb3 100644 --- a/src/components/navbar.vue +++ b/src/components/navbar.vue @@ -1,7 +1,7 @@ - - diff --git a/src/pages.json b/src/pages.json index 59ac520..2986f47 100644 --- a/src/pages.json +++ b/src/pages.json @@ -116,7 +116,7 @@ ], "subPackages": [ { - "root": "pages-sub", + "root": "bundle", "pages": [ { "path": "coupon/coupon", diff --git a/src/pages/about/about.vue b/src/pages/about/about.vue index a01efdb..88afbd7 100644 --- a/src/pages/about/about.vue +++ b/src/pages/about/about.vue @@ -29,7 +29,7 @@ function gotoVueQuery() { } function gotoSubPage() { uni.navigateTo({ - url: '/pages-sub/demo/index', + url: '/bundle/demo/index', }) } // uniLayout里面的变量通过 expose 暴露出来后可以在 onReady 钩子获取到(onLoad 钩子不行) diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 617a4ad..20c27a4 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -107,13 +107,13 @@