> For the complete documentation index, see [llms.txt](https://bpio.gitbook.io/piman/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bpio.gitbook.io/piman/dev-guide/vue2/css-scss-2.md).

# Develope Component

> Give someone a program, you frustrate them for a day;\
> teach them how to program, you frustrate them for a lifetime.
>
> *—— David Leinweber*

開發元件是如此的有趣、有意義，以至於開發者會無時無刻在腦海裡邊寫程式，只為了好用。

<figure><img src="https://3730302285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWkKD42HpQdyU6pMEvZom%2Fuploads%2FtExaHhDkUIzFujRsdb24%2Fimage.png?alt=media&amp;token=169ffb5c-c767-40d7-8d28-a0203707c3a6" alt=""><figcaption><p>一台螢幕發出藍、紅、黃、粉、紫色的筆記型電腦</p></figcaption></figure>

### 開新檔案 <a href="#newfile" id="newfile"></a>

1. 在 src/components 建立 .vue 檔。
2. naming style：Camel Case，以 ‘Bpa’開頭，例如： BpaButton.vue

### 註冊 <a href="#register" id="register"></a>

```javascript
// src/components/index.ts

import BpaButton from "./BpaButton.vue";

const Components: {[key: string]: any} = {
  BpaButton,
  //...
}
```

然後在 .vue 檔使用。

### Type

在 /type 資料夾內新增 newFileName}.d.ts 檔案， 然後在 /types/bpa.d.ts 裡註冊

```javascript
// types/bpa.d.ts

// import
import { BpaNewComponent } from './new-component'

// export
/** NewComponent Component */
export class NewComponent extends BpaNewComponent {}
```

### 如果想快速在 Nuxt2 開發時測試… <a href="#test-in-nuxt2" id="test-in-nuxt2"></a>

1. npm run build
2. 複製 `/dist` 資料夾內容到 Nuxt
3. import piman from “your-path/piman.umd.js
4. npm run dev


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://bpio.gitbook.io/piman/dev-guide/vue2/css-scss-2.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
