Browse Source

添加.prettierrc

pull/48/head
zyronon 1 year ago
parent
commit
bc15b8ec27
  1. 1
      .editorconfig
  2. 11
      .prettierrc
  3. 78
      package.json
  4. 82
      pnpm-lock.yaml
  5. 120
      src/utils/bus.js

1
.editorconfig

@ -9,3 +9,4 @@ indent_size = 2 @@ -9,3 +9,4 @@ indent_size = 2
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120

11
.prettierrc

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
{
"singleQuote": true,
"semi": false,
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"quoteProps": "as-needed",
"jsxSingleQuote": true,
"vueIndentScriptAndStyle": true,
"endOfLine": "lf"
}

78
package.json

@ -1,41 +1,41 @@ @@ -1,41 +1,41 @@
{
"name": "my-vue-app",
"version": "0.0.0",
"scripts": {
"dev": "vite --host",
"build": "vite build --mode prod",
"build-uni-app": "vite build --mode uni",
"report": "vite build",
"preview": "vite preview"
},
"dependencies": {
"@jambonn/vue-lazyload": "1.0.9",
"axios": "1.6.0",
"axios-mock-adapter": "^1.22.0",
"core-js": "3.21.1",
"dayjs": "1.11.0",
"gl-matrix": "3.4.3",
"mitt": "3.0.0",
"mobile-select": "1.1.2",
"mockjs": "^1.1.0",
"pinia": "^2.1.7",
"vue": "3.4.21",
"vue-masonry": "0.16.0",
"vue-router": "4.3.0",
"vue-switches": "2.0.1"
},
"devDependencies": {
"@iconify/vue": "^4.1.1",
"@types/lodash-es": "^4.17.9",
"@vitejs/plugin-vue": "4.0.0",
"@vitejs/plugin-vue-jsx": "3.0.0",
"less": "4.1.3",
"rollup-plugin-visualizer": "^5.9.2",
"unplugin-vue-define-options": "^1.4.1",
"unplugin-vue-macros": "^2.7.10",
"vite": "4.5.2",
"vite-plugin-cdn-import": "0.3.5",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-imagemin": "^0.6.1"
}
"name": "my-vue-app",
"version": "0.0.0",
"scripts": {
"dev": "vite --host",
"build": "vite build --mode prod",
"build-uni-app": "vite build --mode uni",
"report": "vite build",
"preview": "vite preview"
},
"dependencies": {
"@jambonn/vue-lazyload": "1.0.9",
"axios": "1.6.0",
"axios-mock-adapter": "^1.22.0",
"core-js": "3.21.1",
"dayjs": "1.11.0",
"gl-matrix": "3.4.3",
"mitt": "3.0.0",
"mobile-select": "1.1.2",
"mockjs": "^1.1.0",
"pinia": "^2.1.7",
"vue": "3.4.21",
"vue-router": "4.3.0",
"vue-switches": "2.0.1"
},
"devDependencies": {
"@iconify/vue": "^4.1.1",
"@types/lodash-es": "^4.17.9",
"@vitejs/plugin-vue": "4.0.0",
"@vitejs/plugin-vue-jsx": "3.0.0",
"less": "4.1.3",
"prettier": "3.2.5",
"rollup-plugin-visualizer": "^5.9.2",
"unplugin-vue-define-options": "^1.4.1",
"unplugin-vue-macros": "^2.7.10",
"vite": "4.5.2",
"vite-plugin-cdn-import": "0.3.5",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-imagemin": "^0.6.1"
}
}

82
pnpm-lock.yaml

@ -38,9 +38,6 @@ dependencies: @@ -38,9 +38,6 @@ dependencies:
vue:
specifier: 3.4.21
version: 3.4.21
vue-masonry:
specifier: 0.16.0
version: 0.16.0(vue@3.4.21)
vue-router:
specifier: 4.3.0
version: 4.3.0(vue@3.4.21)
@ -64,6 +61,9 @@ devDependencies: @@ -64,6 +61,9 @@ devDependencies:
less:
specifier: 4.1.3
version: 4.1.3
prettier:
specifier: 3.2.5
version: 3.2.5
rollup-plugin-visualizer:
specifier: ^5.9.2
version: 5.12.0(rollup@2.79.1)
@ -1904,10 +1904,6 @@ packages: @@ -1904,10 +1904,6 @@ packages:
engines: {node: '>=0.4.0'}
dev: false
/desandro-matches-selector@2.0.2:
resolution: {integrity: sha512-+1q0nXhdzg1IpIJdMKalUwvvskeKnYyEe3shPRwedNcWtnhEKT3ZxvFjzywHDeGcKViIxTCAoOYQWP1qD7VNyg==}
dev: false
/dir-glob@3.0.1:
resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==}
engines: {node: '>=8'}
@ -2271,10 +2267,6 @@ packages: @@ -2271,10 +2267,6 @@ packages:
/estree-walker@2.0.2:
resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==}
/ev-emitter@1.1.1:
resolution: {integrity: sha512-ipiDYhdQSCZ4hSbX4rMW+XzNKMD1prg/sTvoVmSLkuQ1MVlwjJQQA+sW8tMYR3BLUr9KjodFV4pvzunvRhd33Q==}
dev: false
/exec-buffer@3.2.0:
resolution: {integrity: sha512-wsiD+2Tp6BWHoVv3B+5Dcx6E7u5zky+hUwOHjuH2hKSLR3dvRmX8fk8UD8uqQixHs4Wk6eDmiegVrMPjKj7wpA==}
engines: {node: '>=4'}
@ -2477,12 +2469,6 @@ packages: @@ -2477,12 +2469,6 @@ packages:
semver-regex: 2.0.0
dev: true
/fizzy-ui-utils@2.0.7:
resolution: {integrity: sha512-CZXDVXQ1If3/r8s0T+v+qVeMshhfcuq0rqIFgJnrtd+Bu8GmDmqMjntjUePypVtjHXKJ6V4sw9zeyox34n9aCg==}
dependencies:
desandro-matches-selector: 2.0.2
dev: false
/follow-redirects@1.15.6:
resolution: {integrity: sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==}
engines: {node: '>=4.0'}
@ -2556,10 +2542,6 @@ packages: @@ -2556,10 +2542,6 @@ packages:
npm-conf: 1.1.3
dev: true
/get-size@2.0.3:
resolution: {integrity: sha512-lXNzT/h/dTjTxRbm9BXb+SGxxzkm97h/PCIKtlN/CBCxxmkkIVV21udumMS93MuVTDX583gqc94v3RjuHmI+2Q==}
dev: false
/get-stdin@4.0.1:
resolution: {integrity: sha512-F5aQMywwJ2n85s4hJPTT9RPxGmubonuB10MNYo17/xph174n2MIR33HRguhzVag10O/npM7SPk73LMZNP+FaWw==}
engines: {node: '>=0.10.0'}
@ -2863,12 +2845,6 @@ packages: @@ -2863,12 +2845,6 @@ packages:
replace-ext: 1.0.1
dev: true
/imagesloaded@4.1.4:
resolution: {integrity: sha512-ltiBVcYpc/TYTF5nolkMNsnREHW+ICvfQ3Yla2Sgr71YFwQ86bDwV9hgpFhFtrGPuwEx5+LqOHIrdXBdoWwwsA==}
dependencies:
ev-emitter: 1.1.1
dev: false
/import-lazy@3.1.0:
resolution: {integrity: sha512-8/gvXvX2JMn0F+CDlSC4l6kOmVaLOO3XLkksI7CI3Ud95KDYJuYur2b9P/PUt/i/pDAMd/DulQsNbbbmRRsDIQ==}
engines: {node: '>=6'}
@ -3268,13 +3244,6 @@ packages: @@ -3268,13 +3244,6 @@ packages:
engines: {node: '>=0.10.0'}
dev: true
/masonry-layout@4.2.2:
resolution: {integrity: sha512-iGtAlrpHNyxaR19CvKC3npnEcAwszXoyJiI8ARV2ePi7fmYhIud25MHK8Zx4P0LCC4d3TNO9+rFa1KoK1OEOaA==}
dependencies:
get-size: 2.0.3
outlayer: 2.1.1
dev: false
/mdn-data@2.0.14:
resolution: {integrity: sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==}
dev: true
@ -3530,14 +3499,6 @@ packages: @@ -3530,14 +3499,6 @@ packages:
arch: 2.2.0
dev: true
/outlayer@2.1.1:
resolution: {integrity: sha512-+GplXsCQ3VrbGujAeHEzP9SXsBmJxzn/YdDSQZL0xqBmAWBmortu2Y9Gwdp9J0bgDQ8/YNIPMoBM13nTwZfAhw==}
dependencies:
ev-emitter: 1.1.1
fizzy-ui-utils: 2.0.7
get-size: 2.0.3
dev: false
/ow@0.17.0:
resolution: {integrity: sha512-i3keDzDQP5lWIe4oODyDFey1qVrq2hXKTuTH2VpqwpYtzPiKZt2ziRI4NBQmgW40AnV5Euz17OyWweCb+bNEQA==}
engines: {node: '>=10'}
@ -3774,6 +3735,12 @@ packages: @@ -3774,6 +3735,12 @@ packages:
engines: {node: '>=4'}
dev: true
/prettier@3.2.5:
resolution: {integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==}
engines: {node: '>=14'}
hasBin: true
dev: true
/process-nextick-args@2.0.1:
resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==}
dev: true
@ -4579,21 +4546,6 @@ packages: @@ -4579,21 +4546,6 @@ packages:
fsevents: 2.3.3
dev: true
/vue-demi@0.13.11(vue@3.4.21):
resolution: {integrity: sha512-IR8HoEEGM65YY3ZJYAjMlKygDQn25D5ajNFNoKh9RSDMQtlzCxtfQjdQgv9jjK+m3377SsJXY8ysq8kLCZL25A==}
engines: {node: '>=12'}
hasBin: true
requiresBuild: true
peerDependencies:
'@vue/composition-api': ^1.0.0-rc.1
vue: ^3.0.0-0 || ^2.6.0
peerDependenciesMeta:
'@vue/composition-api':
optional: true
dependencies:
vue: 3.4.21
dev: false
/vue-demi@0.14.7(vue@3.4.21):
resolution: {integrity: sha512-EOG8KXDQNwkJILkx/gPcoL/7vH+hORoBaKgGe+6W7VFMvCYJfmF2dGbvgDroVnI8LU7/kTu8mbjRZGBU1z9NTA==}
engines: {node: '>=12'}
@ -4609,22 +4561,6 @@ packages: @@ -4609,22 +4561,6 @@ packages:
vue: 3.4.21
dev: false
/vue-masonry@0.16.0(vue@3.4.21):
resolution: {integrity: sha512-0Wi/BH4iYYRrAAFY/wokczz0lWWPg1vmOvFW4aC2nKybKf6kVqUvFfR9/+izDfzG657/vY+Om0gqOB5YPxPxuQ==}
peerDependencies:
'@vue/composition-api': ^1.0.0-rc.1
vue: ^2.0.0 || >=3.0.0
peerDependenciesMeta:
'@vue/composition-api':
optional: true
dependencies:
imagesloaded: 4.1.4
masonry-layout: 4.2.2
mitt: 3.0.0
vue: 3.4.21
vue-demi: 0.13.11(vue@3.4.21)
dev: false
/vue-router@4.3.0(vue@3.4.21):
resolution: {integrity: sha512-dqUcs8tUeG+ssgWhcPbjHvazML16Oga5w34uCUmsk7i0BcnskoLGwjpa15fqMr2Fa5JgVBrdL2MEgqz6XZ/6IQ==}
peerDependencies:

120
src/utils/bus.js

@ -1,65 +1,65 @@ @@ -1,65 +1,65 @@
export default {
eventMap: new Map(),
on(eventType, cb) {
let cbs = this.eventMap.get(eventType)
if (cbs) {
cbs.push(cb)
} else {
cbs = [cb]
}
if (cbs.length > 10) {
// console.error('eventMap', this.eventMap)
}
this.eventMap.set(eventType, cbs)
},
once(eventType, cb) {
this.eventMap.set(eventType, [cb])
},
off(eventType, fn) {
let cbs = this.eventMap.has(eventType);
if (cbs) {
if (fn) {
let cbs = this.eventMap.get(eventType)
let rIndex = cbs.findIndex(v => v === fn)
if (rIndex > -1) {
cbs.splice(rIndex, 1)
}
this.eventMap.set(eventType, cbs)
} else {
this.eventMap.delete(eventType);
}
}
},
offAll() {
this.eventMap = new Map()
},
emit(eventType, val) {
let cbs = this.eventMap.get(eventType)
if (cbs) {
cbs.map(cb => cb(val))
}
}
eventMap: new Map(),
on(eventType, cb) {
let cbs = this.eventMap.get(eventType)
if (cbs) {
cbs.push(cb)
} else {
cbs = [cb]
}
if (cbs.length > 10) {
// console.error('eventMap', this.eventMap)
}
this.eventMap.set(eventType, cbs)
},
once(eventType, cb) {
this.eventMap.set(eventType, [cb])
},
off(eventType, fn) {
let cbs = this.eventMap.has(eventType)
if (cbs) {
if (fn) {
let cbs = this.eventMap.get(eventType)
let rIndex = cbs.findIndex((v) => v === fn)
if (rIndex > -1) {
cbs.splice(rIndex, 1)
}
this.eventMap.set(eventType, cbs)
} else {
this.eventMap.delete(eventType)
}
}
},
offAll() {
this.eventMap = new Map()
},
emit(eventType, val) {
let cbs = this.eventMap.get(eventType)
if (cbs) {
cbs.map((cb) => cb(val))
}
},
}
export const EVENT_KEY = {
SINGLE_CLICK: 'SINGLE_CLICK',
SINGLE_CLICK_BROADCAST: 'SINGLE_CLICK_BROADCAST',
ENTER_FULLSCREEN: 'ENTER_FULLSCREEN',
EXIT_FULLSCREEN: 'EXIT_FULLSCREEN',
TOGGLE_FULLSCREEN: 'TOGGLE_FULLSCREEN',
TOGGLE_COMMENT: 'TOGGLE_COMMENT',
OPEN_COMMENTS: 'OPEN_COMMENTS',
CLOSE_COMMENTS: 'CLOSE_COMMENTS',
DIALOG_MOVE: 'DIALOG_MOVE',
DIALOG_END: 'DIALOG_END',
OPEN_SUB_TYPE: 'OPEN_SUB_TYPE',
CLOSE_SUB_TYPE: 'CLOSE_SUB_TYPE',
ITEM_TOGGLE: 'ITEM_TOGGLE',
ITEM_PLAY: 'ITEM_PLAY',
ITEM_STOP: 'ITEM_STOP',
NAV: 'NAV',
GO_USERINFO: 'GO_USERINFO',
SHOW_SHARE: 'SHOW_SHARE',
UPDATE_ITEM: 'UPDATE_ITEM',
CURRENT_ITEM: 'CURRENT_ITEM',
SINGLE_CLICK: 'SINGLE_CLICK',
SINGLE_CLICK_BROADCAST: 'SINGLE_CLICK_BROADCAST',
ENTER_FULLSCREEN: 'ENTER_FULLSCREEN',
EXIT_FULLSCREEN: 'EXIT_FULLSCREEN',
TOGGLE_FULLSCREEN: 'TOGGLE_FULLSCREEN',
TOGGLE_COMMENT: 'TOGGLE_COMMENT',
OPEN_COMMENTS: 'OPEN_COMMENTS',
CLOSE_COMMENTS: 'CLOSE_COMMENTS',
DIALOG_MOVE: 'DIALOG_MOVE',
DIALOG_END: 'DIALOG_END',
OPEN_SUB_TYPE: 'OPEN_SUB_TYPE',
CLOSE_SUB_TYPE: 'CLOSE_SUB_TYPE',
ITEM_TOGGLE: 'ITEM_TOGGLE',
ITEM_PLAY: 'ITEM_PLAY',
ITEM_STOP: 'ITEM_STOP',
NAV: 'NAV',
GO_USERINFO: 'GO_USERINFO',
SHOW_SHARE: 'SHOW_SHARE',
UPDATE_ITEM: 'UPDATE_ITEM',
CURRENT_ITEM: 'CURRENT_ITEM',
}

Loading…
Cancel
Save