CARVIEW |
Select Language
HTTP/2 200
date: Sat, 19 Jul 2025 03:35:00 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-robots-tag: none
etag: W/"ceaa01adb7d50895974c9404a29e1f90"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=H28qPmjucEccfXEFaBYarHfjyWEwBNIgH8TuomWRN%2FcVTYCsoXzBXEGXR5iqaaVVNAxJQg9%2B%2FHMYryUljKjTZYS%2F71gKxUIp9GB%2Fk6nGLr2KbG8IPhMInj3GdlwCcojOHrGxpXy1xh0GziexvNSXeP6PtpQ%2F07O7L3F8cW8QNlzQ09RsVQEx2E709mv8gaGkcT6Th%2Bd8DVhCJFX%2BRac7Ii42ZUb8boELZgI2yOs5bY5oRCco0DCOkijIvwiqvCrFRA9q6kRFJLPT4JOGpE2YYg%3D%3D--VZtEvRs%2BhCeaxsgC--wRE47MuCGQy%2BoAELO3VtRw%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1097788604.1752896100; Path=/; Domain=github.com; Expires=Sun, 19 Jul 2026 03:35:00 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Sun, 19 Jul 2026 03:35:00 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: D4F4:21415F:531F3:76A63:687B1264
Usage · hiyali/vue-smooth-picker Wiki · GitHub
Skip to content
Navigation Menu
{{ message }}
-
-
Notifications
You must be signed in to change notification settings - Fork 34
Usage
Raman Selivonchyk edited this page Feb 18, 2020
·
5 revisions
npm
npm i -S vue-smooth-picker
or yarn
yarn add vue-smooth-picker
import 'vue-smooth-picker/dist/css/style.css'
import SmoothPicker from 'vue-smooth-picker'
Vue.use(SmoothPicker)
<template>
...
<smooth-picker ref="smoothPicker" :data="data" :change="change" />
...
</template>
name | type | default | explain |
---|---|---|---|
change |
Function |
(gIndex, iIndex) => {} | Callback after data current index changed, pass two arguments, group index gIndex and item index iIndex
|
data |
Array |
[] | SmoothPicker initial data |
data[i].currentIndex |
Number |
0 | Current index of this group's list |
data[i].flex |
Number |
1 | Group weights in parent width 1..12
|
data[i].list |
Array |
- | List of the group |
data[i].list[j] |
String or Object
|
- | Item in the list of group, use value key when it is a object item |
data[i].onClick |
Function |
- | Click event on the middle layer of this group, pass two arguments, this group index gIndex and selected index iIndex of this group |
data[i].textAlign |
String |
- |
left center or right in item block |
data[i].className |
String |
- | Your custom class name for this group |
data[i].divider |
Boolean |
false | If it is true, then onClick list currentIndex will be not used |
data[i].text |
String |
- | Just used when divider is true |
name | type | explain |
---|---|---|
setGroupData |
Function |
Dynamically set a group data with two arguments (gIndex, gData) , group index and group data (see props data[i] ) |
getCurrentIndexList |
Function |
Return a Array of the groups current index list (has divider current index, and it is default to 0 ) |
<template>
<div class="example-page">
<!-- 3. Use -->
<smooth-picker ref="smoothPicker" :data="data" :change="dataChange" />
<button class="button" type="button" @click="confirm">Confirm</button>
</div>
</template>
<script>
// 1. import
import 'vue-smooth-picker/dist/css/style.css'
import { SmoothPicker } from 'vue-smooth-picker'
export default {
name: 'example-page',
components: {
SmoothPicker // 2. register
},
data () {
return {
// 4. pass data
data: [
{
currentIndex: 0,
flex: 3,
list: [
'Plan A - free', 'Plan B - $50', 'Plan C - $100'
],
onClick: this.clickOnPlan,
textAlign: 'center',
className: 'row-group'
},
{
divider: true,
flex: 1,
text: 'product',
textAlign: 'center',
className: 'divider'
},
{
currentIndex: 2,
flex: 3,
list: [
'1 * A item', '2 * A items', '3 * A items', '4 * A items', '5 * A items'
],
onClick: this.clickOnProduct,
textAlign: 'center',
className: 'item-group'
}
]
}
},
methods: {
// 5. listen change event
dataChange (gIndex, iIndex) {
console.info('list', gIndex, iIndex)
if (gIndex === 0) {
let currentIndex = 0
let list = []
switch (iIndex) {
case 2:
list = ['C item 1', 'C item 2', 'C item 3', 'C item 4', 'C item 5', 'C item 6', 'C item 7', 'C item 8', 'C item 9']
currentIndex = 4
break
case 1:
list = ['1 * B item', '2 * B items', '3 * B items', '4 * B items', '5 * B items', '6 * B items', '7 * B items']
currentIndex = 3
break
default:
list = ['1 * A item', '2 * A items', '3 * A items', '4 * A items', '5 * A items']
currentIndex = 2
}
this.$refs.smoothPicker.setGroupData(2, Object.assign({}, this.data[2], { currentIndex, list }))
}
},
// 6. listen click event
clickOnPlan (gIndex, iIndex) {
window.alert('Clicked plan: ' + this.data[gIndex].list[iIndex])
},
clickOnProduct (gIndex, iIndex) {
window.alert('Clicked product: ' + this.data[gIndex].list[iIndex])
},
// 7. get finally data's index list
confirm () {
const ciList = this.$refs.smoothPicker.getCurrentIndexList()
const planDetail = this.data[0].list[ciList[0]]
const productDetail = this.data[2].list[ciList[2]]
window.alert(
'Confirmed index list: ' + ciList + '.\n' +
'Confirmed plan: ' + planDetail + '.\n' +
'Confirmed product: ' + productDetail
)
}
}
}
</script>
npm run dev # development
npm run build # build
You can’t perform that action at this time.