File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,10 @@ export default function get(options: UseGetOptions): UseGetData {
5555 options
5656 )
5757
58- const _id = computed ( ( ) => id )
58+ function getId ( ) : null | string | number {
59+ return isRef ( id ) ? id . value : id || null
60+ }
61+
5962 const servicePath = computed < string > ( ( ) => model . servicePath )
6063 const state = reactive < UseGetState > ( {
6164 item : computed ( ( ) => {
@@ -80,7 +83,7 @@ export default function get(options: UseGetOptions): UseGetData {
8083 isLocal : local
8184 } )
8285
83- function get < T > ( id , params ) : T {
86+ function get < T > ( id , params ?: Params ) : T {
8487 const idToUse = isRef ( id ) ? id . value : id
8588 const paramsToUse = isRef ( params ) ? params . value : params
8689
@@ -108,9 +111,9 @@ export default function get(options: UseGetOptions): UseGetData {
108111 }
109112
110113 watch (
111- ( ) => [ _id , params ] ,
112- ( [ _id , params ] ) => {
113- get ( _id , params )
114+ ( ) => [ getId ( ) , params ] ,
115+ ( [ id , params ] ) => {
116+ get ( id , params )
114117 } ,
115118 { lazy }
116119 )
You can’t perform that action at this time.
0 commit comments