Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
vue-shufflejs-plugin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dmstr
vue-shufflejs-plugin
Commits
cd41ba61
Commit
cd41ba61
authored
Sep 27, 2018
by
Marc Mautz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated selected filters & cleanup
parent
e55690c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
20 deletions
+18
-20
VueShuffleNavbar.vue
src/components/VueShuffleNavbar.vue
+18
-20
No files found.
src/components/VueShuffleNavbar.vue
View file @
cd41ba61
...
...
@@ -101,7 +101,7 @@
{label: 'Rank (DESC)', value: 'rank-desc', icon: 'glyphicon glyphicon-arrow-down', order: 'DESC'} */
],
queryStrings
:
false
,
selectedFilters
:
[]
selectedFilters
:
{}
}
},
created
()
{},
...
...
@@ -109,15 +109,14 @@
const
qs
=
window
.
location
.
hash
.
split
(
'?'
)[
1
]
this
.
queryStrings
=
this
.
parseQueryString
(
qs
)
console
.
log
(
'queryStrings'
,
this
.
queryStrings
)
console
.
log
(
'$refs'
,
this
.
$refs
)
const
refs
=
this
.
$refs
for
(
const
prop
in
refs
)
{
// console.log(this.queryStrings[prop])
// console.log(prop, refs[prop][0].options
)
this
.
setSelectedFilters
(
prop
,
refs
[
prop
][
0
],
this
.
queryStrings
[
prop
])
}
console
.
log
(
'selectedFilters'
,
this
.
selectedFilters
)
setTimeout
(()
=>
{
const
refs
=
this
.
$refs
for
(
const
prop
in
refs
)
{
this
.
setSelectedFilters
(
prop
,
refs
[
prop
][
0
],
this
.
queryStrings
[
prop
]
)
}
console
.
log
(
'selectedFilters'
,
this
.
selectedFilters
)
},
500
)
},
computed
:
{},
methods
:
{
...
...
@@ -128,20 +127,18 @@
* @param {String} qs
*/
setSelectedFilters
(
key
,
ref
,
qs
)
{
// console.log('setSelectedFilters', key, ref, qs)
let
filters
=
[]
filters
[
key
]
=
[]
for
(
const
prop
in
qs
)
{
const
id
=
Number
(
qs
[
prop
])
// console.log(id, ref.options
)
const
found
=
ref
.
options
.
find
(
function
(
element
)
{
return
element
.
value
===
id
})
// console.log(key
)
filters
[
key
].
push
(
found
)
if
(
qs
.
hasOwnProperty
(
prop
))
{
const
id
=
Number
(
qs
[
prop
]
)
const
found
=
ref
.
options
.
find
((
element
)
=>
{
return
element
.
value
===
id
})
filters
.
push
(
found
)
}
}
//
console.log('filters', filters)
this
.
selectedFilters
.
push
(
filters
)
console
.
log
(
'filters'
,
filters
)
this
.
selectedFilters
[
key
]
=
filters
},
/**
* Parse query string and return as array
...
...
@@ -199,6 +196,7 @@
// this.filtered[id] = value.map(a => a.label)
this
.
filtered
[
id
]
=
value
console
.
log
(
'filtered'
,
this
.
filtered
)
console
.
log
(
'$refs'
,
this
.
$refs
)
this
.
$emit
(
'filterChange'
,
this
.
filtered
)
},
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment