Files
Neo-ZQYY/tmp/DEMO-miniprogram/miniprogram/components/ai-inline-icon/ai-inline-icon.ts

39 lines
1.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Component({
options: {
styleIsolation: 'shared',
},
/**
* ai-inline-icon — 行首 AI 小图标组件
*
* ## 用法
* 1. 在页面/组件的 .json 中注册:
* "ai-inline-icon": "/components/ai-inline-icon/ai-inline-icon"
*
* 2. 在 WXML 中使用:
* <!-- 固定配色 -->
* <ai-inline-icon color="indigo" />
*
* <!-- 页面随机配色(推荐) -->
* <ai-inline-icon color="{{aiColor}}" />
*
* ## color 可选值
* red | orange | yellow | blue | indigo默认| purple
*
* ## 样式来源
* 全局 app.wxss.ai-inline-icon + .ai-color-*
*
* ## 页面随机配色初始化(复制到 Page.onLoad
* const AI_COLORS = ['red','orange','yellow','blue','indigo','purple']
* const aiColor = AI_COLORS[Math.floor(Math.random() * AI_COLORS.length)]
* this.setData({ aiColor })
*/
properties: {
/** 颜色系列red | orange | yellow | blue | indigo | purple */
color: {
type: String,
value: 'indigo',
},
},
})