update Rate
update Rate
This commit is contained in:
parent
962c40bd3d
commit
e5ac79258a
8 changed files with 32 additions and 3 deletions
BIN
assets/iview.png
BIN
assets/iview.png
Binary file not shown.
Before Width: | Height: | Size: 164 KiB After Width: | Height: | Size: 162 KiB |
|
@ -7,12 +7,18 @@
|
||||||
@click="handleClick(item)">
|
@click="handleClick(item)">
|
||||||
<span :class="[prefixCls + '-star-content']" type="half"></span>
|
<span :class="[prefixCls + '-star-content']" type="half"></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div :class="[prefixCls + '-text']" v-if="showText">
|
||||||
|
<slot>{{ value }} <template v-if="value <= 1">{{ t('i.rate.star') }}</template><template v-else>{{ t('i.rate.stars') }}</template></slot>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import Locale from '../../mixins/locale';
|
||||||
|
|
||||||
const prefixCls = 'ivu-rate';
|
const prefixCls = 'ivu-rate';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [ Locale ],
|
||||||
props: {
|
props: {
|
||||||
count: {
|
count: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
@ -29,6 +35,10 @@
|
||||||
disabled: {
|
disabled: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
showText: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
|
|
@ -83,6 +83,10 @@ export default {
|
||||||
page: '/page',
|
page: '/page',
|
||||||
goto: 'Goto',
|
goto: 'Goto',
|
||||||
p: ''
|
p: ''
|
||||||
|
},
|
||||||
|
rate: {
|
||||||
|
star: 'Star',
|
||||||
|
stars: 'Stars'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -83,6 +83,10 @@ export default {
|
||||||
page: '条/页',
|
page: '条/页',
|
||||||
goto: '跳至',
|
goto: '跳至',
|
||||||
p: '页'
|
p: '页'
|
||||||
|
},
|
||||||
|
rate: {
|
||||||
|
star: '星',
|
||||||
|
stars: '星'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -83,6 +83,10 @@ export default {
|
||||||
page: '條/頁',
|
page: '條/頁',
|
||||||
goto: '跳至',
|
goto: '跳至',
|
||||||
p: '頁'
|
p: '頁'
|
||||||
|
},
|
||||||
|
rate: {
|
||||||
|
star: '星',
|
||||||
|
stars: '星'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -8,7 +8,6 @@
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-family: 'Ionicons';
|
|
||||||
|
|
||||||
&-disabled &-star {
|
&-disabled &-star {
|
||||||
&:before,
|
&:before,
|
||||||
|
@ -26,6 +25,7 @@
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
font-family: 'Ionicons';
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
@ -63,4 +63,10 @@
|
||||||
color: tint(@rate-star-color, 20%);
|
color: tint(@rate-star-color, 20%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&-text {
|
||||||
|
margin-left: 8px;
|
||||||
|
vertical-align: middle;
|
||||||
|
display: inline-block;
|
||||||
|
font-size: @font-size-small;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -6,9 +6,10 @@ import VueRouter from 'vue-router';
|
||||||
import App from './app.vue';
|
import App from './app.vue';
|
||||||
import iView from '../src/index';
|
import iView from '../src/index';
|
||||||
// import locale from '../src/locale/lang/en-US';
|
// import locale from '../src/locale/lang/en-US';
|
||||||
|
import locale from '../src/locale/lang/zh-CN';
|
||||||
|
|
||||||
Vue.use(VueRouter);
|
Vue.use(VueRouter);
|
||||||
Vue.use(iView);
|
Vue.use(iView, { locale });
|
||||||
|
|
||||||
// 开启debug模式
|
// 开启debug模式
|
||||||
Vue.config.debug = true;
|
Vue.config.debug = true;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div style="margin: 100px">
|
<div style="margin: 100px">
|
||||||
{{value}}
|
{{value}}
|
||||||
<br><br><br>
|
<br><br><br>
|
||||||
<Rate :value.sync="value" :count="5" allow-half></Rate>
|
<Rate :value.sync="value" :count="5" allow-half show-text></Rate>
|
||||||
<br><br><br>
|
<br><br><br>
|
||||||
<i-button @click="value++">add</i-button>
|
<i-button @click="value++">add</i-button>
|
||||||
<i-button @click="value--">remove</i-button>
|
<i-button @click="value--">remove</i-button>
|
||||||
|
|
Loading…
Add table
Reference in a new issue