@@ -3,7 +3,8 @@ import BaseProxy from './core/BaseProxy'
33import Validator from './core/Validator'
44import BaseTransformer from './core/BaseTransformer'
55import PaginationTransformer from './core/PaginationTransformer'
6- import merge from 'lodash.merge'
6+ import { merge } from './util'
7+ import _Vue from 'vue'
78
89// augment typings of Vue.js
910import './vue'
@@ -13,29 +14,35 @@ export type { ValidatorType }
1314
1415class VueApiQueries {
1516 installed = false
16- install ( Vue : any , options : any = { } ) {
17+ parsedQs = {
18+ comma : true ,
19+ allowDots : true ,
20+ ignoreQueryPrefix : true ,
21+ }
22+ install ( Vue : typeof _Vue , options : any = { } ) {
1723 if ( this . installed ) return
1824 this . installed = true
19- const defaultOption = merge ( options , {
20- parsedQs : {
21- comma : true ,
22- allowDots : true ,
23- ignoreQueryPrefix : true ,
25+ const defaultOption = merge (
26+ {
27+ parsedQs : this . parsedQs ,
28+ errorProperty : 'errors' ,
2429 } ,
25- errorProperty : 'errors' ,
26- } )
30+ options ,
31+ )
2732 const { axios, errorProperty, parsedQs } = defaultOption
2833 BaseProxy . $http = axios
2934 BaseProxy . $errorProperty = errorProperty || 'errors'
30- BaseProxy . $parsedQs = parsedQs
35+ BaseProxy . $parsedQs = parsedQs || this . parsedQs
3136 Vue . mixin ( {
3237 beforeCreate ( ) {
33- this . $options . $errors = { }
34- Vue . util . defineReactive ( this . $options , '$errors' , Validator )
38+ this . $options . $errors = { } as any
39+ Vue . set ( this . $options , '$errors' , Validator )
3540 if ( ! this . $options . computed ) {
3641 this . $options . computed = { }
3742 }
3843 this . $options . computed . $errors = function ( ) {
44+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
45+ // @ts -ignore
3946 return this . $options . $errors
4047 }
4148 } ,
0 commit comments