shijiplus-web-plugin 0.1.22 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shijiplus-web-plugin",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "files": [
5
5
  "src"
6
6
  ],
@@ -14,7 +14,7 @@ export default {
14
14
  props: {
15
15
  type: {
16
16
  type: String,
17
- default: ''
17
+ default: null
18
18
  },
19
19
  color: {
20
20
  type: String,
@@ -4,14 +4,16 @@ import datePlugin from './date'
4
4
  import stringPlugin from './string'
5
5
  import objectPlugin from './object'
6
6
  import regularPlugin from './regular'
7
+ import viewPlugin from './view'
7
8
 
8
- const install = (vue) => {
9
- console.log('install extentionPlugin')
9
+ const install = (vue, opts) => {
10
+ console.log('install extentionPlugin', opts)
10
11
  vue.use(arrayPlugin)
11
12
  vue.use(datePlugin)
12
13
  vue.use(stringPlugin)
13
14
  vue.use(objectPlugin)
14
15
  vue.use(regularPlugin)
16
+ vue.use(viewPlugin, opts)
15
17
  }
16
18
 
17
19
  export default {
@@ -0,0 +1,26 @@
1
+ import Vue from 'vue'
2
+ const install = (vue, opts = {}) => {
3
+ console.log('------view--install------', opts)
4
+ const removeVComp = (vComp) => {
5
+ if (vComp.$children && vComp.$children.length) {
6
+ vComp.$children.forEach(item => {
7
+ removeVComp(item)
8
+ })
9
+ }
10
+ if (vComp.$el.parentNode) {
11
+ vComp.$el.parentNode.removeChild(vComp.$el)
12
+ }
13
+ }
14
+ vue.prototype.$getComponentInstance = (component) => {
15
+ const ComponentClass = Vue.extend(component)
16
+ const instance = new ComponentClass({ store: opts.store })
17
+ instance.$mount()
18
+ document.body.appendChild(instance.$el)
19
+ return instance
20
+ }
21
+ vue.prototype.$removeVComp = removeVComp
22
+ }
23
+
24
+ export default {
25
+ install
26
+ }
package/src/index.js CHANGED
@@ -20,7 +20,7 @@ export default {
20
20
  /**
21
21
  * 注册指令
22
22
  */
23
- importDirective(vue)
23
+ importDirective(vue, opts)
24
24
  vue.use(ExtentionPlugin)
25
25
  vue.use(iView, {
26
26
  i18n: (key, value) => i18n.t(key, value)
package/src/main.js CHANGED
@@ -7,7 +7,7 @@ import Tool from './index'
7
7
 
8
8
  Vue.config.productionTip = false
9
9
 
10
- Tool.install(Vue)
10
+ Tool.install(Vue, { a: 'aaa' })
11
11
  new Vue({
12
12
  render: h => h(App),
13
13
  }).$mount('#app')