大家好,我是Vue JS的新手,我正尝试使用单个文件模板在我的过滤器上使用mixins,但遇到了一些麻烦
我收到错误
Unknown custom element: <side-bar-one> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
Run Code Online (Sandbox Code Playgroud)
component.js
Vue.component('sideBarOne', require('./component/sidebars/sideBarOne.vue'));
Run Code Online (Sandbox Code Playgroud)
sideBarOne.vue
import { default as config } from '../../../config';
import { filters as filter } from '../../../mixins/filters';
export default {
mixins: [
filter,
],
mounted: function() {
}
}
Run Code Online (Sandbox Code Playgroud)
filter.js
import { default as config } from '../config';
module.exports = {
filters: {
useLGLogo( str ) {
if( str ) {
return config.LG_LOGO …
Run Code Online (Sandbox Code Playgroud) 如何在每个项目中添加新字段,我已经使用put()
但只添加最后一项.
return self::where('latest', 1)
->where('competitionId',$competitionId)
->orderBy('won','desc')
->orderBy('teamName','asc')
->get(['teamName','played','won','lost','percentage', 'streak'])
->put('test', ['123', '345'])
->toJson();
Run Code Online (Sandbox Code Playgroud)
结果:
{
"0": {"teamName": "A"},
"1": {"teamName": "B"},
"2": {"teamName": "C", "test": ['123', '345']},
}
Run Code Online (Sandbox Code Playgroud)
预期产量:
{
"0": {"teamName": "A", "test": "qwerty"},
"1": {"teamName": "B", "test": "qwerty"},
"2": {"teamName": "C", "test": "qwerty"},
}
Run Code Online (Sandbox Code Playgroud) 我目前在我的 Laravel 应用程序上使用Vue 无限加载来显示数据,我面临的问题是,当页面加载时,即使我不滚动页面,它也会请求所有数据。据我所知,它应该只在我当前的滚动位于底部时发出请求。下面是我的代码。
<infinite-loading :on-infinite="onInfinite" spinner="spiral" ref="infiniteLoading">
<span slot="no-more"></span>
</infinite-loading>
import InfiniteLoading from 'vue-infinite-loading';
export default {
data: function(){
return {
leagueLeaders: [],
playerStats: [],
pagination: 1,
}
},
methods: {
components: {
InfiniteLoading,
},
onInfinite() {
let self = this;
axios.get(config.NBLAPI + config.API.PLAYERSTATS2, {
params: {
page: self.pagination,
}
}).then( (response) => {
let data = response.data.data;
let lastpage = response.data.last_page;
if ( response.status == 200 && data.length > 0) {
self.leagueLeaders = self.leagueLeaders.concat(data);
self.$refs.infiniteLoading.$emit('$InfiniteLoading:loaded');
if(self.pagination …
Run Code Online (Sandbox Code Playgroud) 大家好,我正在开发一个使用 nuxt js 的项目,我只是这个框架的新手。我已经将它配置为使用spa模式,仅供参考,我没有在我的 nuxt 配置中更改或添加任何内容,只是默认设置。下面是我如何设置我的页面。
pages/users/index.vue - 显示列表或用户
pages/users/_id.vue - 显示特定用户
我已经使用npm run build和npm run start命令部署了我的项目。然后将 dist 目录托管在 nginx 服务器中。
问题是,当我使用 nuxt 链接导航到/user/id 时,页面可以正确呈现,但是当我直接访问页面 url 或刷新页面时,我找不到 nginx 404 页面。
我已经阅读了关于 nuxt generate 来生成预渲染页面的内容,但是在处理数百条记录时使用这个有用吗?
任何帮助,建议,都会非常有用。
谢谢
在全球范围内注册所有组件是否可行?
原因
这有什么缺点吗?
进行循环时如何获取特定数字,在我的情况下,我只希望获取5个或以上的数字,或在所需范围内。
<select name="" id="input" class="form-control" v-model="selectcompetitionyear">
<option v-for="n in 8" :value="n">Previous {{n}} games</option>
</select>
Run Code Online (Sandbox Code Playgroud)
结果将是
<select name="" id="input" class="form-control" v-model="selectcompetitionyear">
<option value="5">Previous 5 games</option>
<option value="6">Previous 6 games</option>
<option value="7">Previous 7 games</option>
<option value="8">Previous 8 games</option>
</select>
Run Code Online (Sandbox Code Playgroud) 因此,我已经使用root用户使用NVM在本地计算机上全新安装了npm / node,一切看起来都很好,现在的问题是当我尝试在项目文件夹中使用npm install --unsafe-perm -verbose命令进行安装时错误显示在我的终端上。
npm verb stack Error: Command failed: /usr/bin/git clone --depth=1 -q -b 0.0.7 https://github.com/Mango/emitter.git /root/.npm/_cacache/tmp/git-clone-28a98ad9
npm verb stack fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-28a98ad9': Permission denied
npm verb stack
npm verb stack at ChildProcess.exithandler (child_process.js:282:12)
npm verb stack at ChildProcess.emit (events.js:182:13)
npm verb stack at maybeClose (internal/child_process.js:957:16)
npm verb stack at Socket.stream.socket.on (internal/child_process.js:378:11)
npm verb stack at Socket.emit (events.js:182:13)
npm verb stack at Pipe._handle.close [as _onclose] (net.js:598:12)
npm verb …
Run Code Online (Sandbox Code Playgroud) 我目前仍然坚持如何将两个查询结果合并到单个对象下面是我的代码.
EDITED
模型方法
public static function getTeamStats($competitionId, $teamId) {
return TeamCompetitionStatistics::where('competitionId', $competitionId)
->where('teamid', $teamId)
->where('periodNumber', 0)
->get();
}
public static function getTeamPosition($competitionId, $teamId){
return self::where('latest', 1)
->where('competitionId',$competitionId)
->where('competitorId', $teamId)
->get(['position', 'streak'])
->map(function($item, $key){
$item->position = $item->position . date("S", mktime(0, 0, 0, 0, $item->position, 0));
if(strpos($item->streak, '-') !== FALSE) {
$item->streak = str_replace('-', 'L', $item->streak);
}
else {
$item->streak = 'W'.$item->streak;
}
return $item;
});
}
Run Code Online (Sandbox Code Playgroud)
在控制器中获取值
$teamStanding = Ladder::getTeamPosition($request->competitionId, $request->id);
$teamStatistics = TeamCompetitionStatistics::getTeamStats($request->competitionId, $request->id);
$result = $teamStatistics->merge($teamStanding);
Run Code Online (Sandbox Code Playgroud)
返回结果: [{'teamstanding': 'data'}, …
我试图获得前五名球员,我使用 join 根据 personId 获取每个球员的信息,但我的查询返回重复数据。我不知道为什么它会复制记录,任何帮助都会非常有用。谢谢
DB::table('person_competition_statistics as pcs')
->where('pcs.competitionId', $competitionId)
->where('pcs.teamId', $teamId)
->orderBy('pcs.sStealsAverage', 'desc')
->rightJoin('players as player', 'pcs.personId', '=', 'player.personId')
->select(['pcs.personId', 'pcs.sStealsAverage', 'player.firstName', 'player.familyName', 'player.playingPosition', 'player.image_thumb'])
->take(5)
->get();
Run Code Online (Sandbox Code Playgroud)
这是结果
#items: array:5 [?
0 => {#444 ?
+"personId": 29872
+"sStealsAverage": 1.24
+"firstName": "Rhys"
+"familyName": ""
+"playingPosition": ""
+"image_thumb": ""
}
1 => {#438 ?
+"personId": 29872
+"sStealsAverage": 1.24
+"firstName": "Rhys"
+"familyName": ""
+"playingPosition": ""
+"image_thumb": ""
}
2 => {#439 ?
+"personId": 29872
+"sStealsAverage": 1.24
+"firstName": "Rhys"
+"familyName": ""
+"playingPosition": "GRD" …
Run Code Online (Sandbox Code Playgroud) 我被卡住了,无论<a>
标签字体大小如何,我怎样才能使箭头垂直居中?
body {
font-family: Arial, 'sans-serif';
}
a {
font-weight: 500;
font-size: 30px;
color: #000;
}
i {
font-size: 12px !important;
font-weight: 300;
}
Run Code Online (Sandbox Code Playgroud)
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<div>
<a href="#">View Full Chart <i class="fa fa-chevron-right" aria-hidden="true"></i></a>
</div>
Run Code Online (Sandbox Code Playgroud)