我试图创建一个正则表达式来捕捉[[xyz | asd]],但不是[[xyz]]在文本中:
'''Diversity Day'''" is the second episode of the [[The Office (U.S. season 1)]|first season]] of the American [[comedy]] [[television program|television series]] ''[[The Office (U.S. TV series)|The Office]]'', and the show's second episode overall. Written by [[B. J. Novak]] and directed by [[Ken Kwapis]], it first aired in the United States on March 29, 2005, on [[NBC]]. The episode guest stars ''Office'' consulting producer [[Larry Wilmore]] as [[List_of_characters_from_The_Office_(US)#Mr._Brown|Mr. Brown]].
应捕获以下结果:
[[The Office (U.S. season 1)]|first season]] <-- keep …Run Code Online (Sandbox Code Playgroud) 我的情况一定很奇怪,但我对此有好处。这是我的情况:
我有一个基于 json 呈现表单的 Vue 应用程序。例如,JSON:
{
"fields": [{
"name": "firstName",
"title": "Name"
}, {
"name": "lastName",
"title": "Last Name"
}, {
"title": "Hello {{ firstName }}!"
}]
}
Run Code Online (Sandbox Code Playgroud)
从那个 json,最终的渲染必须是:
<input type="text" name="firstName" v-model="firstName" />
<input type="text" name="lastName" v-model="lastName" />
<p>Hello {{ firstName }}</p>
Run Code Online (Sandbox Code Playgroud)
我能够呈现所有这些,除了<p>呈现为原始{{ firstName }}而不是数据绑定/反应性的。
我的问题是:如何将动态模板(可以来自 Rest API)插入到组件中,并使它们具有 mustache 表达式的全部功能。
该组件将具有类似
{...firstName field...}
<dynamic template will be added here and update whenever firstName changes>
Run Code Online (Sandbox Code Playgroud)
如果我对这个问题不太清楚,请告诉我谢谢!!!