{
    "name": "gov-switch",
    "label": "自定义开关",
    "description": "自定义开关",
    "codeSnap": "<view>\n    <gov-switch />\n</view>",
    "groups": "layout",
    "demoCode": {
        "s": "<view class=\"center\">\n    <view class=\"preview-padding\">默认样式</view>\n    <gov-switch />\n    <view class=\"preview-padding\">不带字开关开启</view>\n    <gov-switch \n        value=\"{{true}}\">\n    </gov-switch>\n    <view class=\"preview-padding\">带字切换开关</view>\n    <gov-switch\n        value=\"{{true}}\">\n        <span slot=\"open\">开启</span>\n        <span slot=\"close\">关闭</span>\n    </gov-switch>\n    <view class=\"preview-padding\">禁用开关</view>\n    <gov-switch value=\"{{true}}\" disabled=\"{{true}}\" class=\"padding\"/>\n    <text style=\"white-space:nowrap; padding: 10px\"></text>\n    <gov-switch disabled=\"{{true}}\" />\n    <view class=\"preview-padding\">选中时加载中的开关</view>\n    <gov-switch loading value />\n    <view class=\"preview-padding\">未选中时加载中的开关</view>\n    <gov-switch loading false-value=\"true\" />\n    <view class=\"preview-padding\">自定义颜色开关</view>\n    <gov-switch\n        gov-inner-class=\"gov-inner-class\"\n        active-color=\"green\",\n        inactive-color=\"#c39\",\n        value=\"{{true}}\"\n        bindonChange=\"onChange\">\n        <span slot=\"open\">开启</span>\n        <span slot=\"close\">关闭</span>\n    </gov-switch>\n</view>",
        "js": "Page({\n    data: {},\n    onChange(e) {\n        swan.showToast({\n            title: e.detail === true ? '开关开启' : '开关关闭',\n            icon: 'none'\n        });\n    }\n});\n",
        "css": ".gov-inner-class {\n    color: rgba(156, 243, 243) !important;\n}\n.center {\n    margin-left: 50px;\n}\n.preview-padding {\n    padding: 14px;\n    color: #999;\n    margin-left: -60px;\n}\n"
    },
    "fragement": "",
    "properties": {
        "attributes": [
            {
                "name": "value",
                "type": "Boolean",
                "description": "指定当前是否选中",
                "required": "否",
                "default": "false"
            },
            {
                "name": "disabled",
                "type": "Boolean",
                "description": "禁用开关",
                "required": "否",
                "default": "false"
            },
            {
                "name": "true-value",
                "type": "tring, Number, Boolean",
                "description": "选中时的值，当使用类似 1 和 0 来判断是否选中时会很有用",
                "required": "否",
                "default": "true"
            },
            {
                "name": "false-value",
                "type": "String, Number, Boolean",
                "description": "没有选中时的值，当使用类似 1 和 0 来判断是否选中时会很有用自定义的class名称",
                "required": "否",
                "default": "false"
            },
            {
                "name": "loading",
                "type": "Boolean",
                "description": "加载中的开关",
                "required": "否",
                "default": "false"
            },
            {
                "name": "active-color",
                "type": "String",
                "description": "switch 打开时的背景色",
                "required": "否",
                "default": "#3388ff"
            },
            {
                "name": "inactive-color",
                "type": "String",
                "description": "switch 关闭时的背景色",
                "required": "否",
                "default": "#ededed"
            }
        ],
        "events": [
            {
                "name": "change",
                "type": "Event",
                "description": "checked 改变时触发 change 事件，可以通过e.detail的值判断是否选中，值为true选中，值为false未选中",
                "required": "否",
                "default": "-"
            }
        ],
        "slot": [
            {
                "name": "open",
                "type": "",
                "description": "开关开启",
                "required": "否",
                "default": "-"
            },
            {
                "name": "close",
                "type": "",
                "description": "开关关闭",
                "required": "否",
                "default": "-"
            }
        ],
        "externalClasses": [
            {
                "name": "gov-before-class",
                "type": "",
                "description": "开关状态是开时，前面圆圈的扩展样式类，可通过此class改变其的样式，如宽高圆角",
                "required": "否",
                "default": "-"
            },
            {
                "name": "gov-after-class",
                "type": "",
                "description": "开关状态是关时，后面圆圈的扩展样式类，可通过此class改变其的样式，如宽高圆角",
                "required": "否",
                "default": "-"
            },
            {
                "name": "gov-inner-class",
                "type": "",
                "description": "内部文本区域的扩展样式类，可以通过此class改变其其样式，如设置颜色：color: red",
                "required": "否",
                "default": "-"
            }
        ]
    }
}