Skip to content

Added functionality of programmatic Inc/Dec Page Number + Update Docs + Checkbox fix +Disabled Switch CSS fix + Sidebar ClickNotClose Issue fixed #513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
package-lock.json
yarn.lock

# Editor directories and files
.bitmap
Expand Down
16 changes: 16 additions & 0 deletions docs/.vuepress/components/Demos/Pagination/ProgrammaticChange.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<template>
<div>
<p>Current: {{ currentx }}</p>
<vs-button @click="currentx++">Increment</vs-button>
<vs-button @click="currentx--">Decrement</vs-button>
<br><br>
<vs-pagination :total="20" v-model="currentx"></vs-pagination>
</div>
</template>
<script>
export default {
data: () => ({
currentx: 5
})
}
</script>
36 changes: 36 additions & 0 deletions docs/components/pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,39 @@ export default {
</div>
</vuecode>
</box>


<box>

## Programmatic Inc/Dec

You can also update page number from outside of pagination component.

<vuecode md>
<div slot="demo">
<Demos-Pagination-ProgrammaticChange />
</div>
<div slot="code">

```html
<template>
<div>
<p>Current: {{ currentx }}</p>
<vs-button @click="currentx++">Increment</vs-button>
<vs-button @click="currentx--">Decrement</vs-button>
<br><br>
<vs-pagination :total="20" v-model="currentx"></vs-pagination>
</div>
</template>
<script>
export default {
data: () => ({
currentx: 5
})
}
</script>
```

</div>
</vuecode>
</box>
2 changes: 1 addition & 1 deletion src/components/vsCheckBox/vsCheckBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default {
this.setValueString()
}
else {
this.$emit('input', evt.target.value)
this.$emit('input',!this.value)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does NOT work with what you updated in this line

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested that in doc. In my clone it worked so. Anyway, I will try once again. Because my project is running in production can you please find solution to this first. Because this is MAJOR issue.
Waiting for fix.

Thanks

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is already solved apparently there is a conflict when adding input and change and they run together

this.$emit('change',evt)
}
},
Expand Down
4 changes: 4 additions & 0 deletions src/components/vsPagination/vsPagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ export default {
},
total() {
this.getPages()
},
value(val) {
const pageNum = val < 1 ? 1 : (val <= this.total ? val : this.total)
this.goTo(pageNum)
}
},

Expand Down
2 changes: 1 addition & 1 deletion src/components/vsSideBar/vsSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default {
},
watch:{
value() {
this.addEventClick()
if(!this.clickNotClose) this.addEventClick()
}
},
methods:{
Expand Down
4 changes: 2 additions & 2 deletions src/components/vsSwitch/vsSwitch.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template lang="html">
<div
<button
:class="[
`vs-switch-${color}`,
{
Expand Down Expand Up @@ -43,7 +43,7 @@
></vs-icon>
</span>
<span class="vs-circle-switch vs-switch--circle"/>
</div>
</button>
</template>

<script>
Expand Down