当我访问我的内部页面vue-meta
时,新页面值不会更新。
app.js
import VueMeta from 'vue-meta'
Vue.use(VueMeta, {
refreshOnceOnNavigation: true
})
Run Code Online (Sandbox Code Playgroud)
App.vue
(主要成分)
export default {
metaInfo() {
return {
title: process.env.MIX_APP_NAME,
titleTemplate: `%s | ${process.env.MIX_APP_NAME}`,
meta: [
{ name: "robots", content: "index,follow" },
{
vmid: "description",
name: "description",
content:
"..........",
},
// and many more....
],
}
}
}
Run Code Online (Sandbox Code Playgroud)
post.vue
(内部组件)
export default {
name: "singePost",
data() {
return {
post: "",
};
},
metaInfo() {
return {
title: this.post.name, // not receiving data
meta: [ …
Run Code Online (Sandbox Code Playgroud) 我正在尝试获取getInstalledRelatedApps
文档,但它总是返回空作为[]
.
代码
$(function () {
window.addEventListener('load', () => {
if ("getInstalledRelatedApps" in navigator) {
navigator.getInstalledRelatedApps().then((relatedApps) => {
relatedApps.forEach((app) => {
console.log('platform:', app.platform);
console.log('url:', app.url);
console.log('id:', app.id);
// This field is provided by the UA.
console.log('version:', app.version);
});
});
}
});
});
Run Code Online (Sandbox Code Playgroud) 第一次尝试用laravel
和socket-io
我想很简单的通知发送给管理员。到目前为止,我的事件正在触发,但我需要帮助接收事件通知。
这是非常基础的,因为我想了解这个过程。
Add Product
user X
是在App Product
页。迄今为止
到目前为止,我可以触发事件并获取用户数据(Add Product
页面中的用户)
需要帮助
我需要帮助来了解管理员接收通知的方式。
组件脚本
created() {
let user = JSON.parse(localStorage.getItem("user"))
this.listenForBroadcast(user);
},
methods: {
listenForBroadcast(user) {
Echo.join('userInAddProduct')
.here((Loggeduser) => {
console.log('My user data', Loggeduser);
});
}
}
Run Code Online (Sandbox Code Playgroud)
上面代码的结果
My user data [{…}]
0:
id: 1
name: "Test User"
photo: "User-1588137335.png"
__ob__: Observer {value: {…}, dep: Dep, vmCount: 0}
get id: ƒ reactiveGetter()
set id: ƒ reactiveSetter(newVal) …
Run Code Online (Sandbox Code Playgroud) 如何验证我的数字输入字段仅接受整数而不接受任何类型的小数(逗号/点)?
Component
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
this.savingData = this.formBuilder.group({
amount: ['', Validators.required], // only accept integer 123000
});
Run Code Online (Sandbox Code Playgroud)
HTML
<ion-input type="number" min="1" inputmode="numeric" formControlName="amount" placeholder="{{ 'SAVINGS.amount' | translate }}" ></ion-input>
Run Code Online (Sandbox Code Playgroud)
任何想法?
我试图通过javascript从第二个表中获取特定列并将其数据返回到我的视图,但我不确定它是如何完成的.
price
专栏product_id
,min
,max
和amount
列min
,并max
返回amount
新价格到目前为止这是我的代码(我知道特别是我的控制器方法有识别问题,找到正确的数据)
JavaScript
<script>
$(document).ready(function() {
// if quantity is not selected (default 1)
$('#newprice').empty();
var quantity = parseInt(document.getElementById("quantity").value);
var shipingcost = parseFloat(quantity);
var shipingcostnumber = shipingcost;
var nf = new Intl.NumberFormat('en-US', {
maximumFractionDigits:0,
minimumFractionDigits:0
});
$('#newprice').append('Rp '+nf.format(shipingcostnumber)+'');
// if quantity is changed
$('#quantity').on('change', function() {
var quantity = parseInt(document.getElementById("quantity").value);
var qtyminmax = $(this).val();
if(qtyminmax) {
$.ajax({
url: '{{ …
Run Code Online (Sandbox Code Playgroud) 我正在使用ajax将我的数据发送到控制器并将其保存在数据库中,在我的代码工作之前,我需要在对数据进行排序后对它们进行排序,然后排序它们停止工作%50.
很高兴知道
这是我的旧代码和排序我的数据的解决方案(这导致我现在有这个问题)
我的附加数据(基于选定的集合)包括2种类型的数据
Script of appending data
<script defer>
$(document).ready(function() {
$('select[name="selectset"]').on('change', function() {
var id = $(this).val();
if(id) {
$.ajax({
url: '{{ url('admin/selectset') }}/'+encodeURI(id),
type: "GET",
dataType: "json",
success:function(result) {
$('div#dataaamsg').empty();
$('div#dataaamsg').append('Use <kbd>CTRL</kbd> or <kbd>SHIFT</kbd> button to select multiple options');
result.sort(function(a,b) {
return (a.position > b.position) ? 1 : ((b.position > a.position) ? -1 : 0);
});
$.each(result, function(key1, value1) {
var vvvid = …
Run Code Online (Sandbox Code Playgroud) 字体真棒5星图标有<i class="fas fa-star"></i>
和<i class="far fa-star"></i>
不同是fas , far
和两者的Unicode f005
现在我想用它作为我的评级系统,其中第一个是常规明星,点击成为实心明星,但我如何fas
far
在我的CSS中定义这个?
input.star:checked ~ label.star:before {
content: '\f005';
color: #e74c3c;
transition: all .25s;
font-family: 'Font Awesome 5 Free';
font-weight: 900;
}
label.star:before {
content: '\f005';
font-family: 'Font Awesome 5 Free';
font-weight: 900;
}
Run Code Online (Sandbox Code Playgroud)
我的代码在上面我只得到坚实的明星
我想在我的导航栏中有一个下拉列表,我可以选择一种货币,我的应用程序中的所有价格都转换为选定的货币,我知道我应该使用中间件来解决这个问题,但我不知道如何开始.我使用Fixer和laravel-swap作为汇率的一揽子计划.
我已经制作了一个名为它的中间件Currancy
,它的内容是:
<?php
namespace App\Http\Middleware;
use Closure;
use Swap\Swap;
use Swap\Builder;
class Currancy
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (Session::has('appcurrency') AND array_key_exists(Session::get('appcurrency'), Config::get('currencies'))) {
$currency = Session::get('appcurrency');
App::setLocale($currency);
}
else {
App::setLocale(Config::get('app.currency'));
}
return $next($request);
}
}
Run Code Online (Sandbox Code Playgroud)
我还在currencies.php
config文件夹中创建了一个:
<?php
return [
'IDR' => [
'name' => 'Indunesian Rupiah',
],
'USD' …
Run Code Online (Sandbox Code Playgroud) 我有选择按钮,我选择状态作为我的条目.这个状态来自statuses
表,它不是每个表中的一列(它是一般选项).我想要做的是status_id
在x-editable的帮助下更改表格中的列,但我不知道如何在JavaScript中获取动态数据.
这是我当前的表单,在我的评论的索引页面中显示状态,例如:
<form action="{{route('updatebyajax', $rating->id)}}" method="post">
{{csrf_field()}}
<td class="text-center" style="width:100px;">
<select class="form-control status" name="status_id">
@foreach($statuses as $status)
<option id="rating" class="rating" data-url="{{ route('updateratebyajax', $rating->id) }}" data-pk="{{ $rating->id }}" data-type="select" data-placement="right" data-title="Edit Rate" value="{{$status->id}}">{{$status->title}}</option>
@endforeach
</select>
</td>
</form>
Run Code Online (Sandbox Code Playgroud)
所以我需要的是基本上从statuses
表中获取信息并通过选择更改.
根据要求,这是我的表截图:
PS:这是选择按钮的默认样本: 示例链接
<a href="#" id="status" data-type="select" data-pk="1" data-url="/post" data-title="Select status"></a>
<script>
$(function(){
$('#status').editable({
value: 2,
source: [
{value: 1, text: 'Active'},
{value: 2, text: 'Blocked'},
{value: 3, text: 'Deleted'}
]
});
});
</script> …
Run Code Online (Sandbox Code Playgroud) 我尝试为我的类别制作可排序函数,我正在使用 JQuery UI
category_id
为null,则表示该类别为parent.(在我的情况下,我使用category_id
而不是parent_id
只是不同的命名)Parent->child 1->child 1
childs
category_id
当我通过Ajax删除和删除我的一个类别时更新列
404
在网络上遇到错误category_id
@foreach($Categorys as $cat)
//parent (deep 0)
<li class="parent" id="{{$cat->id}}">
{{$cat->title}}
//first child (deep 1)
@if(count($cat->childs))
@foreach($cat->childs as $child)
<li style="margin-left:20px !important;" class="firstchild" id="{{$child->id}}">
{{$child->title}}
//first child child (deep 2)
@if(count($child->childs))
@foreach($child->childs as $childdd)
<li style="margin-left:40px !important;" class="secondchild" id="{{$childdd->id}}">
{{$childdd->title}}
</li>
@endforeach
@endif
</li>
@endforeach
@endif
</li>
@endforeach
Run Code Online (Sandbox Code Playgroud)
Ajax
$(function() {
$('.mytest').sortable({
stop: function() { …
Run Code Online (Sandbox Code Playgroud) laravel ×7
javascript ×6
php ×5
ajax ×2
android ×1
angular ×1
css ×1
eloquent ×1
font-awesome ×1
html ×1
jquery ×1
jquery-ui ×1
socket.io ×1
typescript ×1
unicode ×1
vue-meta ×1
vue.js ×1
vuejs2 ×1
web ×1
x-editable ×1