Skip to content

Commit f3bcecd

Browse files
committed
remove Vue dependency
1 parent 3ec6c87 commit f3bcecd

File tree

4 files changed

+54
-50
lines changed

4 files changed

+54
-50
lines changed

package.json

Lines changed: 45 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,47 @@
1-
{
2-
"name": "vue-data-dict",
1+
{
2+
"name": "vue-data-dict",
33
"version": "1.0.8",
4-
"description": "data dict for Vue.js",
5-
"main": "src/index.js",
6-
"unpkg": "dist/vue-data-dict.js",
7-
"jsdelivr": "dist/vue-data-dict.js",
8-
"sideEffects": false,
9-
"files": [
10-
"src",
11-
"dist",
12-
"postinstall.js"
13-
],
14-
"scripts": {
15-
"build": "webpack --mode production",
16-
"lint": "eslint src",
17-
"lint:fix": "eslint src --fix",
18-
"postinstall": "node ./postinstall"
19-
},
20-
"repository": {
21-
"type": "git",
22-
"url": "git+https://github.com/moxun1639/vue-data-dict.git"
23-
},
24-
"bugs": {
25-
"url": "https://github.com/moxun1639/vue-data-dict/issues"
26-
},
27-
"homepage": "https://github.com/moxun1639/vue-data-dict#readme",
28-
"keywords": [
29-
"dict",
30-
"data dict",
31-
"Vue"
32-
],
33-
"author": "Moxun<[email protected]>",
34-
"license": "Apache-2.0",
35-
"devDependencies": {
36-
"@babel/core": "^7.10.5",
37-
"@babel/preset-env": "^7.10.4",
38-
"babel-loader": "^8.1.0",
39-
"eslint": "^7.5.0",
4+
"description": "data dict for Vue.js",
5+
"main": "src/index.js",
6+
"unpkg": "dist/vue-data-dict.js",
7+
"jsdelivr": "dist/vue-data-dict.js",
8+
"sideEffects": false,
9+
"files": [
10+
"src",
11+
"dist",
12+
"postinstall.js"
13+
],
14+
"scripts": {
15+
"build": "webpack --mode production",
16+
"lint": "eslint src",
17+
"lint:fix": "eslint src --fix",
18+
"postinstall": "node ./postinstall"
19+
},
20+
"repository": {
21+
"type": "git",
22+
"url": "git+https://github.com/moxun1639/vue-data-dict.git"
23+
},
24+
"bugs": {
25+
"url": "https://github.com/moxun1639/vue-data-dict/issues"
26+
},
27+
"homepage": "https://github.com/moxun1639/vue-data-dict#readme",
28+
"keywords": [
29+
"dict",
30+
"data dict",
31+
"Vue"
32+
],
33+
"author": "Moxun<[email protected]>",
34+
"license": "Apache-2.0",
35+
"devDependencies": {
36+
"@babel/core": "^7.10.5",
37+
"@babel/preset-env": "^7.10.4",
38+
"babel-loader": "^8.1.0",
39+
"eslint": "^7.5.0",
4040
"terser-webpack-plugin": "4.2.3",
41-
"webpack": "^4.43.0",
42-
"webpack-cli": "^3.3.8"
43-
},
44-
"dependencies": {
45-
"merge": "^1.2.1",
46-
"vue": "^2.6.11"
47-
}
48-
}
41+
"webpack": "^4.43.0",
42+
"webpack-cli": "^3.3.8"
43+
},
44+
"dependencies": {
45+
"merge": "^1.2.1"
46+
}
47+
}

src/lib/Dependency.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
Vue: null,
3+
}

src/lib/Dict.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Vue from 'vue'
1+
import Dependency from './Dependency'
22
import DictMeta from './DictMeta'
33
import DictData from './DictData'
44
import merge from 'merge'
@@ -42,8 +42,8 @@ export default class Dict {
4242
const dictMeta = DictMeta.parse(options)
4343
this._dictMetas.push(dictMeta)
4444
const type = dictMeta.type
45-
Vue.set(this.label, type, {})
46-
Vue.set(this.dict, type, [])
45+
Dependency.Vue.set(this.label, type, {})
46+
Dependency.Vue.set(this.dict, type, [])
4747
if (dictMeta.lazy) {
4848
return
4949
}
@@ -101,7 +101,7 @@ function loadDict(dict, dictMeta) {
101101
}
102102
dict.dict[type].splice(0, Number.MAX_SAFE_INTEGER, ...dicts)
103103
dicts.forEach(d => {
104-
Vue.set(dict.label[type], d.value, d.label)
104+
Dependency.Vue.set(dict.label[type], d.value, d.label)
105105
})
106106
return dicts
107107
})

src/lib/install.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import Dependency from './Dependency'
12
import Dict from './Dict'
23
import { mergeOptions } from './DictOptions'
34

45
export default function(Vue, options) {
6+
Dependency.Vue = Vue
57
mergeOptions(options)
68
Vue.mixin({
79
data() {

0 commit comments

Comments
 (0)