我有几个片段用于在崇高文本2中为刀片创建表单元素.
为了使片段更充分,我想添加功能,将镜像文本中的大小写转换为Title Case,并将单词与空格分开,而不是使用下划线.
这是我的代码片段的片段;)
{{ Form::label('$1', '${1/\b(\w*)\b/\u\1/g}') }}
Run Code Online (Sandbox Code Playgroud)
现在,当我在$ 1位置输入时,镜像文本将转换为标题大小写.
因此,刀片文档中的结果可能是例如:
{{ Form::label('password', 'Password') }}
Run Code Online (Sandbox Code Playgroud)
现在,我还想更改镜像文本以使用空格替换下划线,然后转换为标题大小写.这是我无法弄清楚的部分.
所以,而不是这个:
{{ Form::label('password_confirmation', 'Password_confirmation') }}
Run Code Online (Sandbox Code Playgroud)
我想最终得到这个:
{{ Form::label('password_confirmation', 'Password Confirmation') }}
Run Code Online (Sandbox Code Playgroud) 我在一个页面上有多个弹出框,它们都有一个关闭按钮。
如果我通过单击打开它的同一个按钮来关闭弹出窗口,我没有问题。当我单击弹出窗口中的关闭按钮之一时,问题就出现了。
当我点击弹出窗口中的关闭按钮时,弹出窗口关闭,但下次我点击打开它时,它不会打开。只有当我第二次单击该按钮时它才会打开。
HTML:
<button type="button" class="btn btn-default" data-toggle="popover" data-placement="right" data-content="<div class="clearfix"><div class="btn-group"><button class="btn btn-success btn-sm">Yes</button><button class="btn btn-default btn-sm close-popover" data-dismiss="popover" >No</button></div></div></div>" title="Delete this">Delete this</button>
Run Code Online (Sandbox Code Playgroud)
JS:
$.fn.extend({
popoverClosable: function (options) {
var defaults = {
html: true,
template:
'<div class="popover">\
<div class="arrow"></div>\
<div class="popover-header">\
<button type="button" class="close" data-dismiss="popover" aria-hidden="true">×</button>\
<h3 class="popover-title"></h3>\
</div>\
<div class="popover-content"></div>\
</div>'
};
options = $.extend({}, defaults, options);
var $popover_togglers = this;
$popover_togglers.popover(options);
$popover_togglers.on('click', function (e) {
e.preventDefault();
$popover_togglers.not(this).popover('hide');
});
$('html').on('click', '[data-dismiss="popover"]', function (e) {
$popover_togglers.popover('hide');
}); …Run Code Online (Sandbox Code Playgroud) 我正在发送来自 Postman 的推送通知。
我已经设置了 Authorization 和 Content-Type 标头,我的 Body 如下所示:
{
"to" : "faecDTf47y4:APA91bEsGFDeKQtifs-XXXXXXXXXXXXXXXXXXXXXXXXXXX",
"notification": {
"title": "Hello",
"body": "World!",
"icon": "/images/favicon.png"
}
}
Run Code Online (Sandbox Code Playgroud)
当我提交 post 请求时,我得到以下 JSON 响应:
{
"multicast_id": XXXXXXXXXXXXX,
"success": 1,
"failure": 0,
"canonical_ids": 0,
"results": [
{
"message_id": "0:XXXXXXXXXXXXXXXXXXXXXXXX"
}
]
}
Run Code Online (Sandbox Code Playgroud)
因此,看起来它已成功发送,但似乎实际上并未触发通知。
我正在关注本教程:https : //youtu.be/BsCBCudx58g?t=337 到目前为止,一切都在进行中,直到我使用 onMessage() 函数阅读通知。
我的 Service Worker 如下所示:
importScripts('https://www.gstatic.com/firebasejs/4.12.1/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/4.12.1/firebase-messaging.js');
// Initialize Firebase
var config = {
apiKey: "AIzaSyDRXXXXXXXXXXXXXXXXXXXXX",
authDomain: "XXXXXXXXXXXXXX.firebaseapp.com",
databaseURL: "https://XXXXXXXXXX.firebaseio.com",
projectId: "XXXXXXXXXXXXXX",
storageBucket: "XXXXXXXXXXXXXX.appspot.com",
messagingSenderId: "XXXXXXXXXXXXX"
}; …Run Code Online (Sandbox Code Playgroud) javascript push-notification firebase postman firebase-cloud-messaging
嗨我有一个JSON对象("/satisfaction_ratings.json"):
{
"satisfaction_ratings": [{
"id": 217414761,
"updated_at": "2015-02-26T07:15:32Z",
"comment": "You are awesome!"
}, {
"id": 217419001,
"updated_at": "2015-02-28T17:45:39Z",
"comment": "You are great!"
}, {
"id": 220481332,
"updated_at": "2015-03-01T11:19:56Z",
"comment": "You are brilliant!"
}, {
"id": 218225121,
"updated_at": "2015-03-02T05:36:08Z",
"comment": "You are fantastic!"
}, {
"id": 228307861,
"updated_at": "2015-03-25T18:39:47Z",
"comment": "You are incredible!"
}],
"next_page": null,
"previous_page": null,
"count": 5
}
Run Code Online (Sandbox Code Playgroud)
...一些HTML:
<div id="feedback"></div>
Run Code Online (Sandbox Code Playgroud)
...和一些jQuery:
<script>
$.getJSON( "/satisfaction_ratings.json", function( data ) {
var items = [];
$.each(data.satisfaction_ratings, function() {
// console.log(this.comment); …Run Code Online (Sandbox Code Playgroud)