为什么sl不保存在strapi中?
there is a video content type field in which there is a link slug, and when a new video is created, in the get request we get a null slug. tell me what's the matter. didn't install slugify
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在attrapi中呼叫API呼叫之后,请遇到
{slug:null}
吗?好的,这是我所做的,
我根据我的表单字段之一(例如:名称字段)在发布请求之前做了一个变量。
我的FormValues是一个对象,具有
formValues = {name:“ whthing”,decsription:“ whything”}
制作变量:
const slug = formValues.name.name.name.split(split( “”).join(“ - ”) +“ - ” + Math.random();
现在我们可能拥有相同的名称,所以这就是为什么我使用随机值(您可能想使用UUID或类似的东西那)
然后您像这样发送
通知我正在添加Frontend的自定义slug,这是随机的,但基于其中一个字段,但这并不重要,现在Strapi确实做到了没有关于这个常见问题的任何文档,最好的解决方案可能是使用
strapi-plugin-slugify
,但是如果这对您不起作用,您可以随意使用我的解决方案getting stuck at getting
{slug : null}
after api call in strapi?ok, this is what I did
I made a variable before POST request based on one of my form fields (eg:name field)
my formValues is an object with values of form fields like this
formValues = {name:"whatever" , decsription:"whatever"}
make a variable:
const slug = formValues.name.split(" ").join("-") + "-" + Math.random();
now we might have same names, so that's why I used a random value (you might want to use uuid or something like that)
then you send it like this
notice I'm adding a custom slug from frontend which is somehow random but based off of one of the fields, but it doesn't really matter, right now strapi does not have any documentation about this common problem, it seems like the best solution might be using
strapi-plugin-slugify
but if that didn't work for you feel free to use my solution