1234567891011121314151617181920212223242526272829303132333435 |
- <template>
- <fr-svg @click="onClick" :uuid="`fr-icon-switch-button-${size}${strokeWidth}${theme}${fill}${strokeLinecap}${strokeLinejoin}`" :width="size" :height="size" :isCache="true" :src="iconSvg" />
- </template>
- <script>
- // #ifdef UNI-APP-X
- import icons from "../../mixins/icons.uts";
- // #endif
- // #ifndef UNI-APP-X
- import icons from "../../mixins/icons.js";
- // #endif
- /**
- * @description 《切换按钮》图标
- * @tutorial https://www.flowerui.com/documents/flower-icons/icons.html
- * @property {Number} size 图标大小
- * @property {Number} strokeWidth 线段粗细
- * @property {String} theme 图标大小
- * @property {Array} fill 图标颜色,["外部描边颜色","外部填充颜色","内部描边颜色","内部填充颜色"]
- * @property {String} strokeLinecap 图标大小
- * @property {String} strokeLinejoin 图标大小
- * @event {Function} click 图标点击事件
- */
- export default {
- mixins: [icons],
- computed: {
- // #ifdef UNI-APP-X
- iconSvg(): string {
- // #endif
- // #ifndef UNI-APP-X
- iconSvg() {
- // #endif
- return `<?xml version="1.0" encoding="UTF-8"?><svg width="${this.size}" height="${this.size}" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M36 4H12C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20H36C40.4183 20 44 16.4183 44 12C44 7.58172 40.4183 4 36 4Z" fill="${this.colors(1)}" stroke="${this.colors(0)}" stroke-width="${this.strokeWidth}" stroke-linejoin="${this.strokeLinejoin}"/><path d="M36 28H12C7.58172 28 4 31.5817 4 36C4 40.4183 7.58172 44 12 44H36C40.4183 44 44 40.4183 44 36C44 31.5817 40.4183 28 36 28Z" fill="${this.colors(1)}" stroke="${this.colors(0)}" stroke-width="${this.strokeWidth}" stroke-linejoin="${this.strokeLinejoin}"/><path d="M36 14C37.1046 14 38 13.1046 38 12C38 10.8954 37.1046 10 36 10C34.8954 10 34 10.8954 34 12C34 13.1046 34.8954 14 36 14Z" fill="${this.colors(3)}" stroke="${this.colors(2)}" stroke-width="${this.strokeWidth}" stroke-linejoin="${this.strokeLinejoin}"/><path d="M12 38C13.1046 38 14 37.1046 14 36C14 34.8954 13.1046 34 12 34C10.8954 34 10 34.8954 10 36C10 37.1046 10.8954 38 12 38Z" fill="${this.colors(3)}" stroke="${this.colors(2)}" stroke-width="${this.strokeWidth}" stroke-linejoin="${this.strokeLinejoin}"/></svg>`
- }
- }
- }
- </script>
|