Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue-template-mobile
Project
Project
Details
Activity
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
huanglu
vue-template-mobile
Commits
7e30d13c
Commit
7e30d13c
authored
Jul 16, 2020
by
huanglu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增 cos upload
parent
6ca29ee1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
36 deletions
+47
-36
.env.production
.env.production
+3
-2
cos-config.js
config/cos-config.js
+11
-0
index.js
config/index.js
+5
-15
util.js
config/util.js
+20
-17
App.vue
src/App.vue
+0
-1
index.js
src/router/index.js
+3
-1
index.vue
src/views/index/index.vue
+5
-0
No files found.
.env.production
View file @
7e30d13c
VUE_APP_API_HOST = ''
\ No newline at end of file
VUE_APP_API_HOST = ''
BASE_URL = '/'
\ No newline at end of file
config/cos-config.js
0 → 100644
View file @
7e30d13c
const
{
isProd
}
=
require
(
'./util'
);
module
.
exports
=
{
secretId
:
'AKIDmMhgQGAJbkjZ8bfpa5LNAoJfuvkJJuwh'
,
secretKey
:
'gCTs8h8btRo00mIcgYBZh16zd7YpvqRn'
,
enable
:
isProd
,
bucket
:
'test-1257124244'
,
region
:
'ap-chengdu'
,
path
:
'static'
,
}
\ No newline at end of file
config/index.js
View file @
7e30d13c
const
path
=
require
(
'path'
);
const
resolve
=
(
dir
)
=>
path
.
join
(
__dirname
,
'..'
,
dir
);
const
isProd
=
[
'production'
,
'prod'
].
includes
(
process
.
env
.
NODE_ENV
)
const
{
isProd
,
resolve
}
=
require
(
'./util'
);
const
cosConfig
=
require
(
'./cos-config'
)
module
.
exports
=
{
outputDir
:
'
mobile
'
,
outputDir
:
'
dist
'
,
proxy
:
{
'/service-profile'
:
{
target
:
'http://192.168.32.57:3000'
,
changeOrigin
:
true
,
},
},
publicPath
:
isProd
?
'http://test-1257124244.file.myqcloud.com/static/'
:
'/'
,
publicPath
:
isProd
?
`http://
${
cosConfig
.
bucket
}
.file.myqcloud.com/
${
cosConfig
.
path
}
/dist`
:
'/'
,
alias
:
{
// 配置这个,注意配置 jsconfig.json 文件,方便 vscode 能够跳进
'@'
:
resolve
(
'src'
),
...
...
@@ -22,12 +19,5 @@ module.exports = {
skeletonRoutes
:
[
'/'
,
'/normal/about'
],
cosConfig
:
{
secretId
:
''
,
secretKey
:
''
,
enable
:
process
.
env
.
NODE_ENV
===
'production'
,
bucket
:
'test-1257124244'
,
region
:
'ap-chengdu'
,
path
:
'static/'
,
}
cosConfig
};
config/util.js
View file @
7e30d13c
...
...
@@ -3,25 +3,28 @@ const fs = require('fs')
const
multiPages
=
()
=>
{
const
pagesPath
=
path
.
join
(
__dirname
,
'../src/pages'
)
const
pages
=
{}
if
(
fs
.
existsSync
(
pagesPath
))
{
const
files
=
fs
.
readdirSync
(
pagesPath
)
console
.
log
(
files
)
files
.
forEach
(
item
=>
{
const
fileName
=
item
.
split
(
'.'
)[
0
];
pages
[
fileName
]
=
`src/pages/
${
fileName
}
/index.js`
})
}
else
{
return
null
}
return
pages
const
pagesPath
=
path
.
join
(
__dirname
,
'../src/pages'
)
const
pages
=
{}
if
(
fs
.
existsSync
(
pagesPath
))
{
const
files
=
fs
.
readdirSync
(
pagesPath
)
console
.
log
(
files
)
files
.
forEach
((
item
)
=>
{
const
fileName
=
item
.
split
(
'.'
)[
0
];
pages
[
fileName
]
=
`src/pages/
${
fileName
}
/index.js`
})
}
else
{
return
null
}
return
pages
}
const
isProd
=
[
'production'
,
'prod'
].
includes
(
process
.
env
.
NODE_ENV
)
const
resolve
=
(
dir
)
=>
path
.
join
(
__dirname
,
'..'
,
dir
);
module
.
exports
=
{
multiPages
multiPages
,
isProd
,
resolve
}
src/App.vue
View file @
7e30d13c
<
template
>
<div
id=
"app"
>
<router-view
/>
<!--
<loading
/>
-->
</div>
</
template
>
<
script
>
...
...
src/router/index.js
View file @
7e30d13c
...
...
@@ -37,9 +37,11 @@ export {
routes
}
console
.
log
(
'baseurl: '
,
process
.
env
.
BASE_URL
)
const
router
=
new
VueRouter
({
mode
:
'history'
,
base
:
process
.
env
.
BASE_URL
,
base
:
'/'
,
routes
,
scrollBehavior
(
to
,
from
,
savedPosition
)
{
if
(
savedPosition
)
{
...
...
src/views/index/index.vue
View file @
7e30d13c
<
template
>
<div>
this is index path
<button
@
click=
"home"
>
home
</button>
</div>
</
template
>
<
script
>
...
...
@@ -11,6 +13,9 @@ export default {
return
{};
},
methods
:
{
home
()
{
this
.
$router
.
push
(
'/home'
)
}
},
mounted
()
{
}
...
...
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