Autocomplete
Autocomplete สามารถปรับแต่งได้สำหรับคำแนะนำอัจฉริยะของ UnoCSS ใน playground และ VS Code extension
ts
autocomplete: {
templates: [
// theme inferring
'bg-$color/<opacity>',
// short hands
'text-<font-size>',
// logic OR groups
'(b|border)-(solid|dashed|dotted|double|hidden|none)',
// constants
'w-half',
],
shorthands: {
// เท่ากับ `opacity: "(0|10|20|30|40|50|60|70|90|100)"`
'opacity': Array.from({ length: 11 }, (_, i) => i * 10),
'font-size': '(xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl|8xl|9xl)',
// override built-in short hands
'num': '(0|1|2|3|4|5|6|7|8|9)',
},
extractors: [
// ...extractors
],
}templatesใช้ DSL อย่างง่ายเพื่อระบุคำแนะนำ autocompleteshorthandsเป็นแผนที่ของชื่อ shorthand ไปยัง templates ของพวกเขา หากเป็นArrayจะเป็น logic OR groupextractorsเพื่อเลือก classes ที่เป็นไปได้และแปลงคำแนะนำแบบ class-name ให้เป็นรูปแบบที่ถูกต้อง ตัวอย่างเช่น คุณสามารถตรวจสอบวิธีการ implement attributify autocomplete extractorสำหรับความช่วยเหลือเพิ่มเติม โปรดดูที่นี่