Skip to content
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

修复了radio和checkbox的一些bug以及样式修改 #177

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions dist/vonic.min.css

Large diffs are not rendered by default.

20 changes: 9 additions & 11 deletions dist/vonic.min.js

Large diffs are not rendered by default.

9,372 changes: 9,372 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"es6-promise": "^4.0.5",
"fastclick": "^1.0.6",
"object-assign": "^4.1.1",
"shelljs": "^0.8.1",
"storage-js-iso": "^0.2.0",
"vswipe": "1.0.1",
"vue": "^2.2.6",
Expand Down
1 change: 1 addition & 0 deletions src/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default {

const appOptions = {
router,
store,
components: { VonApp },
propsData: {
meta: { // What for?
Expand Down
32 changes: 18 additions & 14 deletions src/components/checkbox/index.vue
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
<template>
<div class="list list-ios von-checkbox">
<div class="item item-borderless item-icon-right"
v-for="(option, i) in options" @click="onClick(i)">
<label class="item item-borderless item-icon-left" v-for="(option, i) in options">
<hairline-top v-if="i > 0"></hairline-top>

<input type="checkbox" :name="checkboxName" :id="checkboxName + '-' + i" v-model="v" :value="i">
<input type="checkbox" :name="checkboxName" :id="checkboxName + '-' + i"
v-model="v" :value="i" @click="onClick(i)" hidden>
<span v-text="option"></span>
<i
<i class="icon ion-ios-checkmark"
:class="{
'icon ion-ios-checkmark-empty assertive': v.indexOf(i) > -1 && theme == 'assertive',
'icon ion-ios-checkmark-empty positive': v.indexOf(i) > -1 && theme == 'positive',
'icon ion-ios-checkmark-empty balanced': v.indexOf(i) > -1 && theme == 'balanced',
'icon ion-ios-checkmark-empty energized': v.indexOf(i) > -1 && theme == 'energized',
'icon ion-ios-checkmark-empty calm': v.indexOf(i) > -1 && theme == 'calm',
'icon ion-ios-checkmark-empty royal': v.indexOf(i) > -1 && theme == 'royal',
'icon ion-ios-checkmark-empty dark': v.indexOf(i) > -1 && theme == 'dark'
'grey': v.indexOf(i) <= -1,
'assertive': v.indexOf(i) > -1 && theme == 'assertive',
'positive': v.indexOf(i) > -1 && theme == 'positive',
'balanced': v.indexOf(i) > -1 && theme == 'balanced',
'energized': v.indexOf(i) > -1 && theme == 'energized',
'calm': v.indexOf(i) > -1 && theme == 'calm',
'royal': v.indexOf(i) > -1 && theme == 'royal',
'dark': v.indexOf(i) > -1 && theme == 'dark'
}"
>
</i>

<hairline-bottom v-if="i < options.length - 1"></hairline-bottom>
</div>
</label>
</div>
</template>
<script>
Expand Down Expand Up @@ -51,8 +52,11 @@
},

computed: {
v: function () {
return this.value
v: {
get:function(){
return this.value
},
set:function(){}
}
},

Expand Down
34 changes: 19 additions & 15 deletions src/components/radio/index.vue
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
<template>
<div class="list von-radio">
<div class="item item-borderless item-icon-left"
<label class="item item-borderless item-icon-left"
v-for="(option, i) in options" @click="onClick(i)"
>
<hairline-top v-if="i > 0"></hairline-top>
<input type="radio" :name="radioId" v-model="v" :value="i">
<input type="radio" :name="radioId" v-model="v" :value="i" @click="onClick(i)" hidden>
<span v-text="option"></span>
<i
class="icon ion-ios-checkmark"
class="icon"
:class="{
'grey': v != i,
'assertive': v == i && theme == 'assertive',
'positive': v == i && theme == 'positive',
'balanced': v == i && theme == 'balanced',
'energized': v == i && theme == 'energized',
'calm': v == i && theme == 'calm',
'royal': v == i && theme == 'royal',
'dark': v == i && theme == 'dark'
'ion-android-radio-button-off grey': v != i,
'ion-android-radio-button-on assertive': v == i && theme == 'assertive',
'ion-android-radio-button-on positive': v == i && theme == 'positive',
'ion-android-radio-button-on balanced': v == i && theme == 'balanced',
'ion-android-radio-button-on energized': v == i && theme == 'energized',
'ion-android-radio-button-on calm': v == i && theme == 'calm',
'ion-android-radio-button-on royal': v == i && theme == 'royal',
'ion-android-radio-button-on dark': v == i && theme == 'dark'
}"
>
</i>
<span v-text="option"></span>


<hairline-bottom v-if="i < options.length - 1"></hairline-bottom>
</div>
</label>
</div>
</template>
<script>
Expand Down Expand Up @@ -53,8 +54,11 @@
},

computed: {
v: function () {
return this.value
v: {
get:function(){
return this.value
},
set:function(){}
}
},

Expand Down
23 changes: 20 additions & 3 deletions src/scss/_checkbox.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
.von-checkbox {
padding-top: 2px;

.item-icon-right {
.item {
padding: 15px 15px 15px 30px;
font-size: 14px;
line-height: 20px;

&:first-of-type, &:last-of-type {
border: none;
}
}

.item-icon-left {
.icon {
font-size: 36px;
right: 5px;
font-size: 24px;
left: -6px;

&.grey {
color: #BBB;
}
}
}

.ion-ios-circle-outline {
color: #ccc;
}
input[type=checkbox] {
position: absolute;
top: -50000px;
Expand Down