0.1.1 • Published 7 years ago

sf-colorpicker v0.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

sf-colorpicker 组件

HEX

:::ysfdoc

    <style>
        .pg-colorpicker{
            text-align: center;

        }
        .pg-colorpicker .sf-colorpicker{
            margin: 0 auto;
        }

    </style>
    <template>
     <div class="pg-colorpicker">
        <sf-colorpicker :hex="hexStr" :on-change="change"></sf-colorpicker>
        <p>HEX</p>
        <p>{{hexStr}}</p>
    </div>
    </template>

    <script>
    export default {
        data () {
            return {
                hexStr : '#E1E1E1',
                rgbStr : 'rgba(255, 0, 0, .5)',
                rgb : {}
            }
        },
        methods : {
            change(color){
                this.rgbStr = color.toRgbString().toUpperCase();
                this.rgb = color.toRgb();
                this.hexStr = color.toHexString().toUpperCase();
            }
        }
    }
    </script>

:::

RGB

:::ysfdoc 参考文献 Rgb, Hex

    <template>
     <div class="pg-colorpicker">
        <sf-colorpicker :hex="rgbStr" :on-change="change"></sf-colorpicker>
        <p>RGB</p>
        <p>{{rgbStr}}</p>
        <p>{{rgb}}</p>
    </div>
    </template>

    <script>
    export default {
        data () {
            return {
                rgbStr : 'rgba(255, 0, 0, .5)',
                hexStr : '#E1E1E1',
                rgb : {}
            }
        },
        methods : {
            change(color){
                this.rgbStr = color.toRgbString().toUpperCase();
                this.rgb = color.toRgb();
                this.hexStr = color.toHexString().toUpperCase();
            }
        }
    }
    </script>

:::

Attributes

参数说明类型可选值默认值
hex颜色值Stringrgba,hex#FFFFFF
on-change变更函数Function
0.1.1

7 years ago

0.1.0

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago