Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to implement a Star Evaluation component in vue-star

Shulou Source: shulou.com Published: 2022-05-31 13:24:04 10月25日 Update

This article focuses on "how to implement a star evaluation component in vue-star". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to implement a star evaluation component in vue-star"!

Create Star.vue under the star folder, and related picture information. Facilitate the nearby maintenance of components

Star.vue:

Const LENGTH = 5; const CLS_ON = 'on'; const CLS_HALF =' half'; const CLS_OFF = 'off'; export default {props: {size: {/ / size, 24authoring 36th type: Number}, score: {type: Number}}, computed: {starSize () {return' star-'+ this.size;}, itemClasses () {let result = []; let score = Math.floor (this.score*2) / 2 / / adjust the value to integer and .5, for example: 4.3 = > 4 4. 6 = > 4. 5 let hasDecimal = score% 1! = = 0; let integer = Math.floor (score); for (let I = 0

Tags: Components content learning practical deeper information interests pictures practicality actual size form simple operation numerical values integers files folders methods more friends Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB vpn Shulou Technology macOS Xiaomi