Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wxh-order-h5
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李俊赕
wxh-order-h5
Commits
744eea64
Commit
744eea64
authored
May 26, 2020
by
ljd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
初始化代码
parent
b99bf594
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
540 additions
and
497 deletions
+540
-497
.editorconfig
web/.editorconfig
+6
-0
.eslintrc.js
web/.eslintrc.js
+308
-290
babel.config.js
web/babel.config.js
+9
-9
package.json
web/package.json
+1
-1
index.js
web/src/store/index.js
+8
-8
Home.vue
web/src/views/Home.vue
+1
-1
layout.vue
web/src/views/common/layout/layout.vue
+0
-1
not-found.vue
web/src/views/common/not-found.vue
+32
-32
About.vue
web/src/views/haier/About.vue
+3
-3
goods.vue
web/src/views/haier/components/goods.vue
+154
-128
service.vue
web/src/views/haier/order/service.vue
+2
-6
vue.config.js
web/vue.config.js
+16
-18
No files found.
web/.editorconfig
View file @
744eea64
...
@@ -3,3 +3,9 @@ indent_style = space
...
@@ -3,3 +3,9 @@ indent_style = space
indent_size = 4
indent_size = 4
trim_trailing_whitespace = true
trim_trailing_whitespace = true
insert_final_newline = true
insert_final_newline = true
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
web/.eslintrc.js
View file @
744eea64
module
.
exports
=
{
module
.
exports
=
{
root
:
true
,
root
:
true
,
parserOptions
:
{
parserOptions
:
{
parser
:
'babel-eslint'
,
parser
:
'babel-eslint'
,
sourceType
:
'module'
sourceType
:
'module'
},
},
env
:
{
env
:
{
browser
:
true
,
browser
:
true
,
node
:
true
,
node
:
true
,
es6
:
true
es6
:
true
},
},
extends
:
[
extends
:
[
"plugin:vue/essential"
,
'plugin:vue/essential'
,
"@vue/standard"
'@vue/standard'
],
],
// add your custom rules here
// add your custom rules here
//
it is base on https://github.com/vuejs/eslint-config-vue
//
it is base on https://github.com/vuejs/eslint-config-vue
//
vue/max-attributes-per-line强制每行的最大属性数https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/max-attributes-per-line.md
//
vue/max-attributes-per-line强制每行的最大属性数https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/max-attributes-per-line.md
//
vue/name-property-casing在Vue组件中为name属性强制执行特定的大小写 https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/name-property-casing.md
//
vue/name-property-casing在Vue组件中为name属性强制执行特定的大小写 https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/name-property-casing.md
//
accessor-pairs这个规则强制执行一个样式,它需要为每个定义了 setter 的属性设置一个 getter
//
accessor-pairs这个规则强制执行一个样式,它需要为每个定义了 setter 的属性设置一个 getter
//
arrow-spacing在箭头功能的箭头之前 之后需要空格 箭头间距
//
arrow-spacing在箭头功能的箭头之前 之后需要空格 箭头间距
//
block-spacing此规则有一个字符串选项 "always" (默认)需要一个或多个空格 "never" 不允许空间
//
block-spacing此规则有一个字符串选项 "always" (默认)需要一个或多个空格 "never" 不允许空间
rules
:
{
rules
:
{
'no-tabs'
:
'off'
,
'vue/max-attributes-per-line'
:
[
'vue/max-attributes-per-line'
:
[
2
,
2
,
{
{
...
@@ -42,7 +46,6 @@ module.exports = {
...
@@ -42,7 +46,6 @@ module.exports = {
],
],
'block-spacing'
:
[
2
,
'always'
],
'block-spacing'
:
[
2
,
'always'
],
'brace-style'
:
[
'brace-style'
:
[
// brace-style 参数 1tbs 强制执行一种真正的大括号样式 stroustrup" 强制执行Stroustrup风格 "allman" 强制执行奥尔曼风格
2
,
2
,
'1tbs'
,
'1tbs'
,
{
{
...
@@ -55,21 +58,32 @@ module.exports = {
...
@@ -55,21 +58,32 @@ module.exports = {
properties
:
'always'
properties
:
'always'
}
}
],
],
'comma-dangle'
:
[
2
,
'never'
],
//comma-dangle "never" (默认值)不允许使用尾随逗号 https://eslint.org/docs/rules/comma-dangle
'comma-dangle'
:
[
2
,
'never'
],
'comma-spacing'
:
[
'comma-spacing'
:
[
// comma-spacing "before": false (默认)在逗号前不允许有空格 "after": true (默认)在逗号后需要一个或多个空格
2
,
2
,
{
{
before
:
false
,
before
:
false
,
after
:
true
after
:
true
}
}
],
],
'comma-style'
:
[
2
,
'last'
],
// comma-style "last"(默认值)在数组元素,对象属性或变量声明的同一行之后需要逗号 "first" 在数组元素,对象属性或变量声明之前和之前需要逗号
'comma-style'
:
[
2
,
'last'
],
'constructor-super'
:
2
,
'constructor-super'
:
2
,
curly
:
[
2
,
'multi-line'
],
curly
:
[
2
,
'multi-line'
],
'dot-location'
:
[
2
,
'property'
],
// dot-location 如果是"object"(默认),则成员表达式中的点应与对象部分位于同一行。 如果是"property",则成员表达式中的点应与属性部分位于同一行
'dot-location'
:
[
2
,
'property'
],
'eol-last'
:
2
,
'eol-last'
:
2
,
eqeqeq
:
[
2
,
'allow-null'
],
// 此规则旨在消除类型不安全的相等运算符 smart模式下不会检查
eqeqeq
:
[
2
,
'allow-null'
],
'generator-star-spacing'
:
[
'generator-star-spacing'
:
[
2
,
2
,
{
{
...
@@ -77,16 +91,21 @@ module.exports = {
...
@@ -77,16 +91,21 @@ module.exports = {
after
:
true
after
:
true
}
}
],
],
'handle-callback-err'
:
[
2
,
'^(err|error)$'
],
//回调模式情况下需要处理异常 https://eslint.org/docs/rules/handle-callback-err.html
'handle-callback-err'
:
[
2
,
'^(err|error)$'
],
indent
:
[
indent
:
[
//强制执行缩进
2
,
2
,
4
,
4
,
{
{
SwitchCase
:
1
SwitchCase
:
1
}
}
],
],
'jsx-quotes'
:
[
2
,
'prefer-single'
],
//强制单引号-双引号
'jsx-quotes'
:
[
2
,
'prefer-single'
],
'key-spacing'
:
[
'key-spacing'
:
[
2
,
2
,
{
{
...
@@ -102,7 +121,6 @@ module.exports = {
...
@@ -102,7 +121,6 @@ module.exports = {
}
}
],
],
'new-cap'
:
[
'new-cap'
:
[
//此规则要求构造函数名称以大写字母开头 https://eslint.org/docs/rules/new-cap "newIsCap": true(默认)要求new使用大写启动函数调用所有运算符。 "newIsCap": false允许new使用小写启动或大写启动函数调用运算符
2
,
2
,
{
{
newIsCap
:
true
,
newIsCap
:
true
,
...
@@ -112,15 +130,15 @@ module.exports = {
...
@@ -112,15 +130,15 @@ module.exports = {
'new-parens'
:
2
,
'new-parens'
:
2
,
'no-array-constructor'
:
2
,
'no-array-constructor'
:
2
,
'no-caller'
:
2
,
'no-caller'
:
2
,
'no-console'
:
'off'
,
//https://eslint.org/docs/rules/no-console
'no-console'
:
process
.
env
.
NODE_ENV
===
'production'
?
'warn'
:
'off'
,
'no-class-assign'
:
2
,
'no-class-assign'
:
2
,
'no-cond-assign'
:
2
,
'no-cond-assign'
:
2
,
'no-const-assign'
:
2
,
'no-const-assign'
:
2
,
'no-control-regex'
:
0
,
'no-control-regex'
:
0
,
'no-delete-var'
:
2
,
//禁止删除变量
'no-delete-var'
:
2
,
'no-dupe-args'
:
2
,
'no-dupe-args'
:
2
,
'no-dupe-class-members'
:
2
,
'no-dupe-class-members'
:
2
,
'no-dupe-keys'
:
2
,
//重复变量
'no-dupe-keys'
:
2
,
'no-duplicate-case'
:
2
,
'no-duplicate-case'
:
2
,
'no-empty-character-class'
:
2
,
'no-empty-character-class'
:
2
,
'no-empty-pattern'
:
2
,
'no-empty-pattern'
:
2
,
...
@@ -270,7 +288,7 @@ module.exports = {
...
@@ -270,7 +288,7 @@ module.exports = {
'yield-star-spacing'
:
[
2
,
'both'
],
'yield-star-spacing'
:
[
2
,
'both'
],
yoda
:
[
2
,
'never'
],
yoda
:
[
2
,
'never'
],
'prefer-const'
:
2
,
'prefer-const'
:
2
,
'no-debugger'
:
process
.
env
.
NODE_ENV
===
'production'
?
2
:
0
,
'no-debugger'
:
process
.
env
.
NODE_ENV
===
'production'
?
'warn'
:
'off'
,
'object-curly-spacing'
:
[
'object-curly-spacing'
:
[
2
,
2
,
'always'
,
'always'
,
...
@@ -280,14 +298,14 @@ module.exports = {
...
@@ -280,14 +298,14 @@ module.exports = {
],
],
'array-bracket-spacing'
:
[
2
,
'never'
],
'array-bracket-spacing'
:
[
2
,
'never'
],
'vue/no-parsing-error'
:
[
2
,
{
'vue/no-parsing-error'
:
[
2
,
{
"x-invalid-end-tag"
:
false
'x-invalid-end-tag'
:
false
}],
}],
"vue/html-indent"
:
[
"error"
,
"tab"
,
{
'vue/html-indent'
:
[
'error'
,
'tab'
,
{
"attribute"
:
1
,
attribute
:
1
,
"baseIndent"
:
0
,
baseIndent
:
0
,
"closeBracket"
:
0
,
closeBracket
:
0
,
"alignAttributesVertically"
:
true
,
alignAttributesVertically
:
true
,
"ignores"
:
[]
ignores
:
[]
}]
}]
}
}
}
}
web/babel.config.js
View file @
744eea64
module
.
exports
=
{
module
.
exports
=
{
presets
:
[
presets
:
[
'@vue/cli-plugin-babel/preset'
,
'@vue/cli-plugin-babel/preset'
// '@vue/app',
// '@vue/app',
// ['es2015', { 'modules': false }]
// ['es2015', { 'modules': false }]
],
],
plugins
:
[[
"component"
,
plugins
:
[[
'component'
,
{
{
"libraryName"
:
"mint-ui"
,
libraryName
:
'mint-ui'
,
"style"
:
true
style
:
true
}
}
]]
]]
}
}
web/package.json
View file @
744eea64
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"@vue/cli-plugin-babel"
:
"~4.3.0"
,
"@vue/cli-plugin-babel"
:
"~4.3.0"
,
"@vue/cli-plugin-eslint"
:
"
~4.3.0
"
,
"@vue/cli-plugin-eslint"
:
"
^4.3.1
"
,
"@vue/cli-plugin-pwa"
:
"~4.3.0"
,
"@vue/cli-plugin-pwa"
:
"~4.3.0"
,
"@vue/cli-plugin-router"
:
"~4.3.0"
,
"@vue/cli-plugin-router"
:
"~4.3.0"
,
"@vue/cli-plugin-vuex"
:
"~4.3.0"
,
"@vue/cli-plugin-vuex"
:
"~4.3.0"
,
...
...
web/src/store/index.js
View file @
744eea64
web/src/views/Home.vue
View file @
744eea64
<
template
>
<
template
>
<div
class=
"home"
>
<div
class=
"home"
>
<img
alt=
"Vue logo"
src=
"../assets/logo.png"
>
<img
alt=
"Vue logo"
src=
"../assets/logo.png"
/
>
<HelloWorld
msg=
"Welcome to Your Vue.js App"
/>
<HelloWorld
msg=
"Welcome to Your Vue.js App"
/>
</div>
</div>
</
template
>
</
template
>
...
...
web/src/views/common/layout/layout.vue
View file @
744eea64
...
@@ -15,5 +15,4 @@ export default {
...
@@ -15,5 +15,4 @@ export default {
</
script
>
</
script
>
<
style
scoped
lang=
"less"
>
<
style
scoped
lang=
"less"
>
</
style
>
</
style
>
web/src/views/common/not-found.vue
View file @
744eea64
<
template
>
<
template
>
<div
class=
"page flex flex-column flex-xc"
>
<div
class=
"page flex flex-column flex-xc"
>
<div
class=
"cnt"
>
<div
class=
"cnt"
>
<img
src=
"../../assets/img/app404.png"
>
<img
src=
"../../assets/img/app404.png"
/
>
<p>
您访问的页面不存在或链接错误
</p>
<p>
您访问的页面不存在或链接错误
</p>
<!--
<a
href=
"/"
class=
"back-home"
>
回首页
</a>
-->
<!--
<a
href=
"/"
class=
"back-home"
>
回首页
</a>
-->
</div>
</div>
...
@@ -15,25 +15,25 @@ export default {
...
@@ -15,25 +15,25 @@ export default {
</
script
>
</
script
>
<
style
scoped
lang=
"less"
>
<
style
scoped
lang=
"less"
>
@import '../../assets/css/func.less'
;
@import "../../assets/css/func.less"
;
.page {
.page {
width: 100%;
width: 100%;
height: 100%;
height: 100%;
text-align: center;
text-align: center;
background-color: #fff;
background-color: #fff;
}
}
.cnt {
.cnt {
align-items: center;
align-items: center;
}
}
.cnt img {
.cnt img {
width: px2rem(370);
width: px2rem(370);
}
}
.cnt p {
.cnt p {
font-size: px2rem(30);
font-size: px2rem(30);
color: #999;
color: #999;
margin-top: px2rem(30);
margin-top: px2rem(30);
}
}
.cnt a.back-home {
.cnt a.back-home {
display: inline-block;
display: inline-block;
height: px2rem(66);
height: px2rem(66);
line-height: px2rem(66);
line-height: px2rem(66);
...
@@ -44,6 +44,6 @@ export default {
...
@@ -44,6 +44,6 @@ export default {
border-radius: px2rem(60);
border-radius: px2rem(60);
margin-top: px2rem(80);
margin-top: px2rem(80);
margin-bottom: px2rem(180);
margin-bottom: px2rem(180);
box-shadow: 0 px2rem(8) px2rem(40) 0 rgba(59,129,255,
.3);
box-shadow: 0 px2rem(8) px2rem(40) 0 rgba(59, 129, 255, 0
.3);
}
}
</
style
>
</
style
>
web/src/views/haier/About.vue
View file @
744eea64
<
template
>
<
template
>
<div
class=
"about"
>
<div
class=
"about"
>
<h1>
This is an about page
</h1>
<h1>
This is an about page
</h1>
</div>
</div>
</
template
>
</
template
>
web/src/views/haier/components/goods.vue
View file @
744eea64
<
template
>
<
template
>
<div
class=
"goods"
>
<div
class=
"goods"
>
<div
class=
"menu-wrapper"
ref =
"menuWrapper"
>
<div
class=
"menu-wrapper"
ref=
"menuWrapper"
>
<ul>
<ul>
<li
v-for =
"(item, index) in goods"
class =
"menu-item"
:class=
"
{'current':currentIndex === index}" :key= "index" @click="selectMenu(index, $event)" >
<li
v-for=
"(item, index) in goods"
class=
"menu-item"
:class=
"
{'current':currentIndex === index}"
:key="index"
@click="selectMenu(index, $event)"
>
<span
class=
"text border-1px"
>
<span
class=
"text border-1px"
>
<span
v-show=
"item.type >0"
class=
"icon"
:class=
"classMap[item.type]"
></span>
{{
item
.
name
}}
<span
v-show=
"item.type >0"
class=
"icon"
:class=
"classMap[item.type]"
></span>
{{
item
.
name
}}
</span>
</span>
</li>
</li>
</ul>
</ul>
</div>
</div>
<div
class=
"foods-wrapper"
ref =
"foodsWrapper"
>
<div
class=
"foods-wrapper"
ref=
"foodsWrapper"
>
<ul>
<ul>
<li
v-for=
"(item, index) in goods"
class=
"food-list food-list-hook"
:key=
"index"
>
<li
v-for=
"(item, index) in goods"
class=
"food-list food-list-hook"
:key=
"index"
>
<h1
class=
"title"
>
{{
item
.
name
}}
</h1>
<h1
class=
"title"
>
{{
item
.
name
}}
</h1>
<ul>
<ul>
<li
@
click =
"selectFood(food, $event)"
v-for=
"(food, index) in item.foods"
class=
"food-item border-1px"
:key=
"index"
>
<li
@
click=
"selectFood(food, $event)"
v-for=
"(food, index) in item.foods"
class=
"food-item border-1px"
:key=
"index"
>
<div
class=
"icon"
>
<div
class=
"icon"
>
<img
width=
"57"
height=
"57"
:src=
"food.icon"
alt=
""
>
<img
width=
"57"
height=
"57"
:src=
"food.icon"
alt
/
>
</div>
</div>
<div
class=
"content"
>
<div
class=
"content"
>
<h2
class=
"name"
>
{{
food
.
name
}}
</h2>
<h2
class=
"name"
>
{{
food
.
name
}}
</h2>
<p
class=
"desc"
>
{{
food
.
description
}}
</p>
<p
class=
"desc"
>
{{
food
.
description
}}
</p>
<div
class=
"extra"
>
<div
class=
"extra"
>
<span
class=
"count"
>
月售
{{
food
.
sellCount
}}
份
</span><span>
好评率
{{
food
.
rating
}}
%
</span>
<span
class=
"count"
>
月售
{{
food
.
sellCount
}}
份
</span>
<span>
好评率
{{
food
.
rating
}}
%
</span>
</div>
</div>
<div
class=
"price"
>
<div
class=
"price"
>
<span
class=
"now"
>
¥
{{
food
.
price
}}
</span>
<span
class=
"now"
>
¥
{{
food
.
price
}}
</span>
<span
v-show=
"food.oldPrice"
class=
"old"
>
¥
{{
food
.
oldPrice
}}
</span>
<span
v-show=
"food.oldPrice"
class=
"old"
>
¥
{{
food
.
oldPrice
}}
</span>
</div>
</div>
<div
class=
"cartcontrol-wrapper"
>
<div
class=
"cartcontrol-wrapper"
>
<cartcontrol
:food=
"food"
v-on:cart-add=
"_cartAdd"
/>
<cartcontrol
:food=
"food"
v-on:cart-add=
"_cartAdd"
/>
</div>
</div>
</div>
</div>
</li>
</li>
...
@@ -37,38 +50,41 @@
...
@@ -37,38 +50,41 @@
</li>
</li>
</ul>
</ul>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{
export
default
{
props
:
{
props
:
{
seller
:
{
seller
:
{
type
:
Object
type
:
Object
}
}
},
},
data
()
{
data
()
{
return
{
return
{
goods
:
[],
goods
:
[],
listHeight
:
[],
listHeight
:
[],
scrollY
:
0
,
scrollY
:
0
,
selectedFood
:
{}
selectedFood
:
{}
}
}
},
},
computed
:
{
computed
:
{
currentIndex
()
{
currentIndex
()
{
for
(
let
i
=
0
;
i
<
this
.
listHeight
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
listHeight
.
length
;
i
++
)
{
let
height1
=
this
.
listHeight
[
i
]
const
height1
=
this
.
listHeight
[
i
]
let
height2
=
this
.
listHeight
[
i
+
1
]
const
height2
=
this
.
listHeight
[
i
+
1
]
if
(
!
height2
||
(
this
.
scrollY
>=
height1
&&
this
.
scrollY
<
height2
))
{
if
(
!
height2
||
(
this
.
scrollY
>=
height1
&&
this
.
scrollY
<
height2
)
)
{
return
i
return
i
}
}
}
}
return
0
return
0
},
},
selectFoods
()
{
selectFoods
()
{
le
t
foods
=
[]
cons
t
foods
=
[]
this
.
goods
.
forEach
((
good
)
=>
{
this
.
goods
.
forEach
(
good
=>
{
good
.
foods
.
forEach
((
food
)
=>
{
good
.
foods
.
forEach
(
food
=>
{
if
(
food
.
count
)
{
if
(
food
.
count
)
{
foods
.
push
(
food
)
foods
.
push
(
food
)
}
}
...
@@ -77,72 +93,82 @@ export default {
...
@@ -77,72 +93,82 @@ export default {
return
foods
return
foods
}
}
},
},
created
(){
created
()
{
this
.
classMap
=
[
'decrease'
,
'discount'
,
'special'
,
'invoice'
,
'guarantee'
];
this
.
classMap
=
[
'decrease'
,
'discount'
,
'special'
,
'invoice'
,
'guarantee'
]
this
.
$http
.
get
(
'api/goods'
).
then
(
response
=>
{
this
.
$http
.
get
(
'api/goods'
).
then
(
response
=>
{
response
=
response
.
body
response
=
response
.
body
if
(
response
.
errno
===
ERR_OK
)
{
if
(
response
.
errno
===
ERR_OK
)
{
this
.
goods
=
response
.
data
this
.
goods
=
response
.
data
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
_initScroll
()
this
.
_initScroll
()
this
.
_calculateHeight
()
this
.
_calculateHeight
()
})
})
}
}
})
})
},
},
methods
:
{
methods
:
{
selectFood
(
food
,
event
)
{
selectFood
(
food
,
event
)
{
if
(
!
event
.
_constructed
)
{
if
(
!
event
.
_constructed
)
{
return
return
}
}
this
.
selectedFood
=
food
this
.
selectedFood
=
food
this
.
$refs
.
food
.
show
()
this
.
$refs
.
food
.
show
()
},
},
selectMenu
(
index
,
event
)
{
selectMenu
(
index
,
event
)
{
if
(
!
event
.
_constructed
)
{
if
(
!
event
.
_constructed
)
{
return
return
}
}
let
foodList
=
this
.
$refs
.
foodsWrapper
.
getElementsByClassName
(
'food-list-hook'
)
const
foodList
=
this
.
$refs
.
foodsWrapper
.
getElementsByClassName
(
let
el
=
foodList
[
index
]
'food-list-hook'
)
const
el
=
foodList
[
index
]
this
.
foodsScroll
.
scrollToElement
(
el
,
300
)
this
.
foodsScroll
.
scrollToElement
(
el
,
300
)
},
},
_drop
(
target
)
{
_drop
(
target
)
{
this
.
nextTick
(()
=>
{
this
.
nextTick
(()
=>
{
this
.
$refs
.
shopcart
.
_drop
(
target
)
this
.
$refs
.
shopcart
.
_drop
(
target
)
})
})
},
},
_initScroll
()
{
_initScroll
()
{
this
.
menuScroll
=
new
BScroll
(
this
.
$refs
.
menuWrapper
,
{
this
.
menuScroll
=
new
BScroll
(
this
.
$refs
.
menuWrapper
,
{
click
:
true
click
:
true
})
})
this
.
foodsScroll
=
new
BScroll
(
this
.
$refs
.
foodsWrapper
,
{
this
.
foodsScroll
=
new
BScroll
(
this
.
$refs
.
foodsWrapper
,
{
probeType
:
3
,
probeType
:
3
,
click
:
true
click
:
true
})
})
this
.
foodsScroll
.
on
(
'scroll'
,
(
pos
)
=>
{
this
.
foodsScroll
.
on
(
'scroll'
,
pos
=>
{
this
.
scrollY
=
Math
.
abs
(
Math
.
round
(
pos
.
y
))
this
.
scrollY
=
Math
.
abs
(
Math
.
round
(
pos
.
y
))
})
})
},
},
_calculateHeight
()
{
_calculateHeight
()
{
let
foodList
=
this
.
$refs
.
foodsWrapper
.
getElementsByClassName
(
'food-list-hook'
)
const
foodList
=
this
.
$refs
.
foodsWrapper
.
getElementsByClassName
(
'food-list-hook'
)
var
height
=
0
var
height
=
0
this
.
listHeight
.
push
(
height
)
this
.
listHeight
.
push
(
height
)
for
(
let
i
=
0
;
i
<
foodList
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
foodList
.
length
;
i
++
)
{
le
t
item
=
foodList
[
i
]
cons
t
item
=
foodList
[
i
]
height
+=
item
.
clientHeight
height
+=
item
.
clientHeight
this
.
listHeight
.
push
(
height
)
this
.
listHeight
.
push
(
height
)
}
}
},
},
_cartAdd
(
event
)
{
_cartAdd
(
event
)
{
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
$refs
[
'shopcart'
]
.
drop
(
event
)
this
.
$refs
.
shopcart
.
drop
(
event
)
});
})
}
}
},
},
components
:
{
components
:
{
shopcart
,
shopcart
,
cartcontrol
,
cartcontrol
,
food
food
}
}
}
}
</
script
>
</
script
>
web/src/views/haier/order/service.vue
View file @
744eea64
...
@@ -17,13 +17,9 @@ export default {
...
@@ -17,13 +17,9 @@ export default {
'mt-button'
:
Button
'mt-button'
:
Button
},
},
data
()
{
data
()
{
return
{
return
{}
}
},
},
mounted
()
{},
mounted
()
{},
methods
:
{
methods
:
{}
}
}
}
</
script
>
</
script
>
web/vue.config.js
View file @
744eea64
const
path
=
require
(
'path'
)
;
//
引入path模块
const
path
=
require
(
'path'
)
//
引入path模块
function
resolve
(
dir
){
function
resolve
(
dir
)
{
return
path
.
join
(
__dirname
,
dir
)
//
path.join(__dirname)设置绝对路径
return
path
.
join
(
__dirname
,
dir
)
//
path.join(__dirname)设置绝对路径
}
}
module
.
exports
=
{
module
.
exports
=
{
devServer
:
{
devServer
:
{
...
@@ -10,16 +10,13 @@ module.exports = {
...
@@ -10,16 +10,13 @@ module.exports = {
},
},
proxy
:
'http://localhost:8080'
proxy
:
'http://localhost:8080'
},
},
lintOnSave
:
process
.
env
.
NODE_ENV
!==
'production'
,
//
lintOnSave: process.env.NODE_ENV !== 'production',
lintOnSave
:
true
,
chainWebpack
:
(
config
)
=>
{
chainWebpack
:
(
config
)
=>
{
// 设置别名
// 设置别名
config
.
resolve
.
alias
config
.
resolve
.
alias
.
set
(
'@'
,
resolve
(
'./src'
))
.
set
(
'@'
,
resolve
(
'./src'
))
.
set
(
'components'
,
resolve
(
'./src/components'
))
.
set
(
'components'
,
resolve
(
'./src/components'
))
//set第一个参数:设置的别名,第二个参数:设置的路径
},
chainWebpack
:
config
=>
{
config
.
module
config
.
module
.
rule
(
'eslint'
)
.
rule
(
'eslint'
)
.
use
(
'eslint-loader'
)
.
use
(
'eslint-loader'
)
...
@@ -28,5 +25,6 @@ module.exports = {
...
@@ -28,5 +25,6 @@ module.exports = {
options
.
fix
=
true
options
.
fix
=
true
return
options
return
options
})
})
// set第一个参数:设置的别名,第二个参数:设置的路径
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment