简体   繁体   English

将道具推入 Supabase 过滤 - VUE3,Supabase

[英]Pushing props into Supabase filtering - VUE3, Supabase

Trying to push through a prop to the.like filtering option in supabase function. Due to.like needing % in value, im not sure how to push the prop through.尝试将道具推送到 supabase function 中的.like 过滤选项。由于.like 需要 % 的值,我不确定如何推送道具。 Please see below.请看下面。

const fetchData = async () => {
 const { data, error } = await supabase
 .from('sneaker')
 .select()
 .eq('brand', props.model?.brand)
 .like('name', '%Yeezy%')
 filteredList1.value = data
 console.log(data)
}

I would like to have props.model?.name instead of '%Yeezy%'.我想要 props.model?.name 而不是“%Yeezy%”。 I have tried adding in the prop like stated but does not work.我试过按照说明添加道具,但没有用。 Much appreciated.非常感激。

Have you tried concatenating the string?您是否尝试过连接字符串?

.like('name', `%${props.model?.name}%`)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM