简体   繁体   English

Keystonejs:生成的URL类型字段未通过单击作为链接打开

[英]Keystonejs: generated URL type field is not opened as a link by click

I use Keystone JS Types.Url type of field to show clickable (by link) field of object in the generated admin UI: 我使用Keystone JS Types.Url字段类型在生成的管理UI中显示对象的可点击(按链接)字段:

Message.add({
  uId: { type: String, initial: true, required: true },
  title: { type: String, initial: true, required: true },
  stat: { type: Types.Url, default: '', required: false, label: 'Statistics' }
})

Message.schema.add({ status: mongoose.Schema.Types.Mixed })

Message.schema.pre('save', function (next) {
  this.stat = 'link_to_config'
  next()
})

Message.defaultColumns = 'uId, stat'
Message.register()

Field 'stat' is shown correctly by <a href=""> in the generated admin UI. 生成的管理用户界面中的<a href="">正确显示了字段'stat'

Problem: 问题:

Field 'stat' is not opened with a click, but the link is changed in the browser's address bar correctly or it can be opened by using ctrl + click 不能通过单击打开“ stat”字段, 但可以在浏览器的地址栏中正确更改链接 ,也可以使用ctrl + click来打开它

Is it a bug or I do something wrong? 是错误还是我做错了什么?

The URL type is not meant to appear as a URL in the Admin panel. URL类型并不意味着在“管理”面板中显示为URL。 It's meant to provide validation and formatting for items to be stored as URLs; 它旨在为要存储为URL的项目提供验证和格式设置; they have no function as clickable links within the Admin panel at all. 它们根本没有任何功能可作为“管理”面板中的可点击链接。

Source: http://keystonejs.netlify.com/api/field/url/ 来源: http//keystonejs.netlify.com/api/field/url/

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

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