Google Page Speed在这里向我报告了一个我无法理解的错误。
删除未使用的代码 我使用了 Google Page Speed 所说的所有 javascript,实际上 vendor.js 是项目的主要脚本。与 Webpack 和 Laravel 编译和统一。
那么为什么 Google Page Speed 说我不使用这些脚本呢?在我上传 lazysizes 插件之前,我没有得到任何这些。
另一方面,网站加载速度很快。我认为 Google Page Speed 非常不可靠。
我从php收到一个带有客户评论的数组:
var comment_list = new Vue({
el: '#comment-list',
data: {
testimonials: JSON.parse('{!! addslashes(json_encode(array_reverse($product_info['testimonials'])))!!}'),
},
methods: {
colorAvatar: function(letter) {
return 'avatar-' + letter.toLowerCase();
},
starClass: function(star) {
return 'star-' + star;
}
}
});
Run Code Online (Sandbox Code Playgroud)
我想创建一个按钮来加载更多内容并以十个十的比例显示评论。
我该怎么做?
在我的vue组件js代码中,我收到此错误:
未捕获的SyntaxError:无效或意外的令牌
这是我的代码:
Vue.component('pickpoint-info', {
template : '<table>\ // in this line I get the error
<tbody>\
<tr v-for="item in items" v-on:click="selectPickPoint(this)">\
<td width="50" align="center"><input name="pickpointid" type="radio" value="{{ item.customer_id }}"></td>\
<td width="300">\
<b>{{ item.name }}</b> <i style="font-size:9px;">#{{ item.customer_id }}</i>\
<br>\
{{ item.address }}\
<br>\
{{ item.postal_code }}\
<a href="{{ item.map_link }}" target="_blank" style="font-size:10px;">(ver en el mapa</a>)\
</td>\
</tr>\
</tbody>\
</table>\
',
Run Code Online (Sandbox Code Playgroud)
这段代码有什么问题?
我收到了这个数据库的日期:2017-02-06T22:25:12Z
我尝试用Carbon php格式化:
{{ \Carbon\Carbon::createFromFormat('Y-m-d H', '2017-02-06T22:25:12Z')->toDateTimeString() }}
Run Code Online (Sandbox Code Playgroud)
但这不起作用,我想要这个日期格式:06-02-17 22:25:12