
在Digitalocean上免費獲得100美元的學分:
加入我們的不和諧:
Metawrite是AppWrite SDK,準備好使用Svelte / SvelteKit組件
該軟件包由Matchio維護。
注意:版本
xxn表示包裝文檔或打字的一些小更改。版本
xnx可能包括一些小的破壞變化。請參閱發行說明。版本
nxx可能包括一些重大的破壞變化。請參閱發行說明。
該軟件包與AppWrite Server 0.12,Web SDK 6和Sveltekit完全兼容。但是,人們目前在npm install metawrite方面面臨困難。我們已經準備好並配置了使用Metawrite的Sveltekit模板,也可以用作此處所述的Docker圖像。
請考慮使用模板,這是暫時的
使用NPM:
npm install metawrite使用紗線:
yarn add metawrite<User /><Create /><Preferences /><RecoverPassword /><Update /><Verification /><AuthEmail /><AuthOAuth2 /><CreateAnonymousSession /><CreateJWT /><MagicURL /><Browser /><CreditCard /><Favicon /><Flag /><Image /><QR /><Collection /><Document /><Storage /><FileList /><File /><Function /><Continents /><Countries /><Currencies /><Languages /><Locale /><PhoneCodes />您需要AppWrite的運行實例才能使用此庫。請訪問https://appwrite.io/docs/installation以獲取更多說明。
psuedo示例
完全從Svelte標記中處理多個級別的異步關係數據(及其加載和後備狀態)。
<!-- 1. ? Appwrite App -->
< Appwrite {... config }>
<!-- 2. ? Get the current user if logged in -->
< User let:user >
< h1 >Hello { user . name }!</ h1 >
<!-- 3. Get all the documents from a collection -->
< Collection collectionId = " 5f56a3035a01f " let:documents >
You have { documents . length } documents.
{ #each documents as document }
<!-- 4. Get a document -->
< Document collectionId = "5f56a3035a01f" documentId ={ document . $id } { document }>
Title: { document . title }
Text: { document . text }
...必須初始化並包裝每個metawrite組件。
< script >
import { Appwrite } from ' metawrite ' ;
const config = {
endpoint : ' http://localhost/v1 ' ,
project : ' demo ' ,
locale : ' fr '
};
</ script >
< Appwrite {... config }>...</ Appwrite >| 姓名 | 描述 |
|---|---|
endpoint | 您的AppWrite端點。 @type - {string} |
project | 您的項目ID。 @type - {string} |
locale | 可選的用戶語言環境。 @type - {string} |
realtime | 可選的設置自定義實時端點。默認情況下,與endpoint相同。 @type - {string} |
註冊一個新帳戶。
< script >
import { Create } from ' metawrite ' ;
let email = ' ' ;
let password = ' ' ;
let name = ' ' ;
const success = ( e ) => {
// success callback
// `e` contains the user object
};
const failure = ( e ) => {
// failure callback
};
</ script >
< Create let:actions on:success on:failure >
< input type = "text" bind:value ={ email } />
< input type = "password" bind:value ={ password } />
< input type = "text" bind:value ={ name } />
< button on:click ={ actions . create ( email , password , name )}>Register</ button >
</ Create >讓:動作object
具有功能的對象。
| 姓名 | 描述 |
|---|---|
create(email, password, name) | 註冊新用戶。 @type - {string} |
ON:成功
觸發成功的註冊。
| 姓名 | 描述 |
|---|---|
response | 回覆 |
在:失敗
觸發失敗的寄存器。
| 姓名 | 描述 |
|---|---|
response | 回覆 |
通過電子郵件和密碼登錄。
< script >
import { AuthEmail } from ' metawrite ' ;
let email = ' ' ;
let password = ' ' ;
const success = ( e ) => {
// success callback
// `e` contains the user object
};
const failure = ( e ) => {
// failure callback
};
</ script >
< AuthEmail let:authorize on:success on:failure >
< input type = "text" bind:value ={ email } />
< input type = "text" bind:value ={ password } />
< button on:click ={ authorize ( email , password )}>Login</ button >
</ AuthEmail >讓:授權function
啟動登錄。
| 姓名 | 描述 |
|---|---|
email | 電子郵件。 @type - {string} |
password | 密碼。 @type - {string} |
ON:成功
觸發成功登錄。
| 姓名 | 描述 |
|---|---|
email | 電子郵件。 @type - {string} |
在:失敗
觸發失敗的登錄。
| 姓名 | 描述 |
|---|---|
error | 錯誤對象。 |
通過OAuth2提供商登錄。
< script >
import { AuthOAuth2 } from ' metawrite ' ;
</ script >
< AuthOAuth2
authProvider = " google "
success = " http://localhost:3000?success "
failure = " http://localhost:3000?failure "
let:authorize
>
< button on:click ={ authorize }>Login Google</ button >
</ AuthOAuth2 >| 姓名 | 描述 |
|---|---|
authProvider | OAuth2提供商。 @type - {string} |
success | 成功URL。 @type - {string} |
failure | 故障URL。 @type - {string} |
讓:授權function
請求當前用戶檢查是否登錄。
< script >
import { User } from ' metawrite ' ;
</ script >
< User let:user >
< h1 >Hello { user . name }!</ h1 >
< div >{ user . email }</ div >
< div slot = " error " >You are not logged in!</ div >
</ User >讓:用戶object
當前登錄用戶數據。
從集合中獲取所有文檔的列表。
< script >
import { Collection } from ' metawrite ' ;
</ script >
< Collection collectionId = " 5f56a3035a01f " let:documents >
You have { documents . length } documents.
</ Collection >| 姓名 | 描述 |
|---|---|
collectionId | 收集獨特的ID。 @type - {string} |
| 額外的 | 和這裡一樣 |
讓:文檔array
一系列文件。
讓:動作object
具有功能的對象。
| 姓名 | 描述 |
|---|---|
reload() | 重新提取集合。 |
create(data, read, write) | 在集合中創建一個新文檔。 read / write是可選的,當前用戶默認情況下@type - {string[]} 。 data是@type - {string} |
獲取文件。如果將document屬性傳遞給了來自數據,則不會要求任何數據。
< script >
import { Document } from ' metawrite ' ;
</ script >
< Document documentId = " 5f56a3asda01f " let:document >
Title: { document . title }
Text: { document . text }
</ Document >| 姓名 | 描述 |
|---|---|
documentId | 記錄獨特的ID。 @type - {string} |
collectionId | 收集獨特的ID。 @type - {string} |
| 或者 | |
document | 從<Collection />傳遞的文檔 |
讓:文檔object
帶有文檔數據的JSON對象。
讓:動作object
具有功能的對象。
| 姓名 | 描述 |
|---|---|
update(data) | 更新文檔。 data是@type - {string} |
remove() | 刪除文檔。 |
reload() | 重新提取文檔。 |
在:更改
觸發更新或刪除登錄。
帳戶組件允許您管理用戶帳戶。
<User /> 讓:動作
| 姓名 | 描述 |
|---|---|
reload() | 重新加載。 |
logout() | 註銷當前會話。 |
logoutAll() | 從所有會話中註銷。 |
logoutFrom(session) | 從特定會話註銷。 session是@type - {string} |
objectlogout成功方面的成功。logout失敗時的FailuroLogout。logoutFrom成功。logoutFrom失敗上進行的FailuroLogout。logoutAll成功的SuccessLogoutall。logoutAll失敗上的FailureLogoutall。 < script >
import { User } from ' metawrite ' ;
</ script >
< User let:actions let:user >
< button on:click ={ actions . reload ()}>Reload user data</ button >
< button on:click ={ actions . get ()}>Get logged in user data</ button >
< button on:click ={ actions . logout ()}>Log out from current session</ button >
< button on:click ={ actions . logoutFrom ( ' sessionId ' )}>Log out from specific session</ button >
< button on:click ={ actions . logoutAll ()}>Log out from all sessions</ button >
<!-- If logged in -->
< p >Hi, { user . name }</ p >
</ User ><Create /> 讓:動作
| 姓名 | 描述 |
|---|---|
create(email, password, name) | 創建用戶。需要email和password - @type - {string} 。 name是可選的- @type - {string} |
create成功的成功。create失敗的故障。 < script >
import { Create } from ' metawrite ' ;
let name,
email,
password = ' ' ;
const success = ( e ) => {
// success callback
// `e` contains the user object
};
const failure = ( e ) => {
// failure callback
};
</ script >
< Create let:actions on:success on:failure >
< input type = "text" name = "name" placeholder = "name" bind:value ={ name } />
< input type = "text" name = "email" placeholder = "email" bind:value ={ email } />
< input type = "password" name = "password" placeholder = "password" bind:value ={ password } />
< button on:click ={ actions . create ( name , email , password )}>Create Account</ button >
</ Create ><Preferences /> 讓:動作
| 姓名 | 描述 |
|---|---|
reload() | 重新加載偏好。 |
update(prefs) | 更新首選項。 prefs @type - {object} |
reload Success的成功。reload失敗的失敗。updateupdate失敗時的失敗。 < script >
import { Preferences } from ' metawrite ' ;
let prefs = {
// You can pass only the specific settings you wish to update.
};
</ script >
< Preferences let:actions >
< button
on:click ={() => {
actions . update ( prefs );
actions . reload ();
}}>Update Preferences</ button
>
</ Preferences ><RecoverPassword /> 讓:動作
| 姓名 | 描述 |
|---|---|
recover(email, url) | 恢復密碼。需要email和url , @type - {string} 。 url是您的頁面,您將在其中處理complete功能的secret 。 |
complete(user, secret, password, passwordAgain) | 完成密碼恢復。 user和secret是通過metawrite自動設置的,因此您不必設置它們。需要password和passwordAgain - @type - {string} 。 |
reload成功的繼任者。reload失敗的FAILURERERECOVER。update成功。update失敗時失敗。 < script >
import { RecoverPassword } from " metawrite " ;
const url = " http://localhost:3000/reset-password " ; // URL that will point to the next step.
let email = ' ' ;
const successRecover = e => {
// success callback
// `e` contains the user object
};
const failureRecover = e => {
// failure callback
}
</ script >
<!-- localhost/forgot-password -->
< RecoverPassword let:actions on:successRecover on:failureRecover >
< input name = "email" type = "text" bind:value ={ email , url } placeholder = " Email " />
< button on:click { actions . recover ( email )}>Recover Password</ button >
</ RecoverPassword >
<!-- Then on localhost/reset-password -->
< script >
import { RecoverPassword } from " metawrite " ;
let password, passwordAgain = ' ' ;
const successComplete = e => {
// success callback
// `e` contains the user object
};
const failureComplete = e => {
// failure callback
}
</ script >
< RecoverPassword let:actions on:successComplete on:failureComplete >
< input type = "password" name = "password" bind:value { password } placeholder = " Password " />
< input type = "password" name = "password" bind:value { passwordAgain } placeholder = " Confirm Password " />
< button on:click { actions . complete ( password , passwordAgain )}>Set New Password</ button >
</ RecoverPassword ><Update /> 讓:動作
| 姓名 | 描述 |
|---|---|
name(name) | 更新名稱。所有字段都是必需的。 @type - {string} |
email(email, password) | 更新電子郵件。所有字段都是必需的。 @type - {string} |
password(password, oldPassword) | 更新密碼。所有字段都是必需的。 @type - {string} |
name成功。name失敗的FailureName。email成功的成功郵件。email失敗中的失敗。password成功上。password失敗的失敗通信。 < script >
import { Update } from ' metawrite ' ;
let name,
email,
password,
newPassword,
oldPassword = ' ' ;
</ script >
< Update let:actions >
< button on:click ={ actions . name ( name )}>This updates name</ button >
< button on:click ={ actions . email ( email , password )}>This updates email</ button >
< button on:click ={ actions . password ( newPassword , oldPassword )}>This updates password</ button >
</ Update ><Verification />創建並自動驗證用戶電子郵件驗證。
create類型字符串的url應該是您的應用程序的託管或localhost位置。update操作,您無需通過任何內容,該過程是自動化的。 讓:動作
| 姓名 | 描述 |
|---|---|
create(url) | 創建驗證。 url是URL用於創建驗證鏈接發送到您的電子郵件收件箱的內容。 @type - {string} |
update(user, secret) | 完整的驗證。 user和secret是通過metawrite自動設置的。 |
create成功的成功。create故障時進行故障。complete成功。complete失敗時失敗。 < script >
import { Verification } from ' metawrite ' ;
const url = window . location . href ;
</ script >
< Verification let:actions >
< button on:click ={ actions . create ( url )} />
< button on:click ={ actions . update ()}>Update email verification status</ button >
</ Verification >驗證組件允許您對用戶帳戶進行身份驗證。
<AuthEmail /> authorize成功。authorize失敗的失敗。 < script >
import { AuthEmail } from ' metawrite ' ;
let email = ' ' ;
let password = ' ' ;
const success = ( e ) => {
// success callback
// `e` contains the user object
};
const failure = ( e ) => {
// failure callback
};
</ script >
< AuthEmail let:authorize on:success on:failure >
< input type = "text" bind:value ={ email } />
< input type = "text" bind:value ={ password } />
< button on:click ={ authorize ( email , password )}>Login</ button >
</ AuthEmail ><AuthOAuth2 /> | 姓名 | 描述 |
|---|---|
authProvider | OAuth2提供商。 @type - {string} |
success | 成功URL。 @type - {string} |
failure | 故障URL。 @type - {string} |
| ####指令 |
讓:授權()
< script >
import { AuthOAuth2 } from ' metawrite ' ;
</ script >
< AuthOAuth2
authProvider = " google "
success = " http://localhost:3000?success "
failure = " http://localhost:3000?failure "
let:authorize
>
< button on:click ={ authorize }>Login Google</ button >
</ AuthOAuth2 ><CreateAnonymousSession /> 讓:動作
| 姓名 | 描述 |
|---|---|
create() | 創建匿名會話。 |
< script >
import { CreateAnonymousSession } from ' metawrite ' ;
</ script >
< CreateAnonymousSession let:actions >
< button on:click ={ actions . create }>Create Anonymous Session</ button >
</ CreateAnonymousSession ><CreateJWT />創建JWT令牌。
讓:動作
| 姓名 | 描述 |
|---|---|
create() | 創建JWT令牌。 |
< script >
import { CreateJWT } from ' metawrite ' ;
</ script >
< CreateJWT let:actions >
< button on:click ={ actions . create }>Create JWT token</ button >
</ CreateJWT ><MagicURL /> 讓:動作
| 姓名 | 描述 |
|---|---|
create(sessionId, email, url) | 創建魔術URL會話。需要電子郵件,URL指出完整的步驟string ,不需要sessionId |
complete() | 驗證並完成魔術URL會話。 |
< script >
import { MagicURL } from " metawrite " ;
let email = " "
const url = " http://localhost:3000/page-to-complete "
const successCreate = ( e ) => {
console . log (e)
}
const failureCreate = ( e ) => {
console . log (e)
}
const successComplete = ( e ) => {
console . log (e)
}
const failureComplete = ( e ) => {
console . log (e)
}
</ script >
< MagicURL let:actions on:successCreate on:successComplete on:failureCreate on:failureComplete >
< input type = "email" name = "email" placeholder = "Email" bind:value ={ email } />
< button on:click ={ actions . create ( email , url )}>Send login link</ button >
< button on:click ={ actions . complete ()}>Confirm Login</ button >
</ MagicURL >頭像組件旨在幫助您完成與應用程序圖像,圖標和化身相關的日常任務。
<Browser /> @type - {string}@type - {number}@type - {string}@type - {string} @type - {URL} < script >
import { Browser } from ' metawrite ' ;
</ script >
< Browser code = " firefox " let:src >
< img src ={ String ( src )} alt = " Browser " />
</ Browser ><CreditCard /> @type - {string}@type - {number}@type - {string}@type - {string} @type - {URL} < script >
import { CreditCard } from ' metawrite ' ;
</ script >
< CreditCard code = " amex " let:src >
< img src ={ String ( src )} alt = " card " />
</ CreditCard ><Favicon /> @type - {string} @type - {URL} < script >
import { Favicon } from ' metawrite ' ;
const url = window . location . href ;
</ script >
< Favicon { url } let:src >
< img src ={ String ( src )} alt = " favicon " />
</ Favicon ><Flag /> @type - {string}@type - {number}@type - {string}@type - {string} @type - {URL} < script >
import { Flag } from ' metawrite ' ;
</ script >
< Flag code = " canada " let:src >
< img src ={ String ( src )} alt = " flag " />
</ Flag ><Image /> @type - {string}@type - {number}@type - {number} @type - {URL} < script >
import { Image } from ' metawrite ' ;
let url = ' https://increas.io/ ' ;
let width,
height = 100 ;
</ script >
< Image { url } { width } { height } let:src >
< img src ={ String ( src )} alt = " someImage " />
</ Image ><QR /> @type - {string}@type - {optional}@type - {number}@type - {boolean} @type - {URL} < script >
import { QR } from ' metawrite ' ;
let text = ' https://increas.io/ ' ; // could be any text
let size = 500 ;
let margin = 1 ;
let download = false ;
</ script >
< QR { text } { size } { margin } { download } let:src >
< img src ={ String ( src )} alt = " QR Code " />
</ QR >數據庫組件允許您創建文檔的結構化集合,查詢和過濾器文檔列表,並管理高級讀寫訪問權限集。
<Collection /> CollectionID-必需@type - {string}
緩存 -可選,默認設置為false @type - {boolean}
查詢: @type - {object}
查詢 -可選@type - {string[]}
限制 -可選@type - {number}
偏移 -可選@type - {number}
光標 -可選@type - {string}
fursordirection-可選@type - {string}
orderattributes-可選@type - {string[]}
ordertypes-可選@type - {string[]}
讓:動作
| 姓名 | 描述 |
|---|---|
reload() | 重新加載。 |
create(documentId, data, read, write) | 創建一個文檔。 data - @type - {string} 。read / write是可選的@type - {string[]} 。documentId是可選的,默認情況下會生成唯一的@type - {string} 。 |
< script >
import { Collection } from " metawrite " ;
</ script >
< Collection collectionId = " 5f56a3035a01f " let:documents >
You have { documents . length } documents.
</ Collection ><Document /> @type - {string}@type - {string} 讓:動作
| 姓名 | 描述 |
|---|---|
reload() | 重新加載。 |
update(data) | 更新文檔。 data - @type - {object} |
remove() | 刪除文件。 |
< script >
import { Collection , Document } from ' metawrite ' ;
const collectionId = ' 5f56a3035a01f ' ;
</ script >
< Collection { collectionId } let:documents >
You have { documents . length } documents:
{ #each documents as document }
< Document { collectionId } documentId ={ document . $id } let:document let:actions >
Title: { document . title }
Text: { document . text }
< button on:click ={() => { actions . remove ()}}>Delete</ button >
</ Document >
{ /each }
</ Collection >有關在AppWrite中使用實時的更多信息,請參閱實時文檔。
實時允許您使用訂閱方法在實時聆聽服務器端上的任何事件。
訂閱無需通過HTTP要求新數據,而是每次更改時都會接收新數據,任何連接的客戶端都會通過WebSocket連接在毫秒內更新。
這使您可以通過實時提供來自AppWrite所有服務的信息來構建交互式且響應的用戶體驗。
string | string[] 讓:有效載荷- 訂閱的有效載荷將包含以下屬性。
讓:動作
| 姓名 | 描述 |
|---|---|
subscribe() | 訂閱與一個或多個渠道有關的所有更新。 |
unsubscribe() | 如果您不再想從訂閱中接收更新,則可以退訂,以便不再調用回調。 |
< script >
import { Realtime } from ' metawrite ' ;
</ script >
< Realtime channels = " account " let:actions let:payload >
< h1 >{ payload . timestamp }</ h1 >
< button on:click ={ actions . subscribe ()}>Subscribe to Account channel</ button >
< button on:click ={ actions . unsubscribe ()}>Unsubscribe from Account channel</ button >
</ Realtime >存儲組件允許您管理項目文件。您可以上傳,查看,下載和查詢所有項目文件。
<Storage /> 讓:動作
| 姓名 | 描述 |
|---|---|
create(bucketId, fileId, file, read, write) | 上傳文件。 需要 fileId @type - {string} , "unique()"將生成隨機的唯一ID,但是您可以使用自定義。file為@type - {File} ,必需。read / write是@type - {string[]}和可選 |
< script lang = " ts " >
import { Storage } from " metawrite "
// Required
let bucketId = " default "
let file : File ;
let fileId = " unique() " ; // this will generate random unique id, but you can use custom
// Optional
let read : string [];
let write : string [];
</ script >
< Storage { file } let:actions >
< button on:click ={ actions . create ( bucketId , fileId , file , read , write )}>Upload File</ button >
</ Storage ><FileList /> @type - {string}@type - {string}@type - {number}@type - {number}@type - {string}@type - {string}@type - {string} =>寫"ASC"或"DESC" 讓:動作
| 姓名 | 描述 |
|---|---|
reload() | 重新加載。 |
< script >
import { FileList } from " metawrite "
// Optional
let bucketId = ' default ' ;
let search = ' ' ;
let limit = 10 ;
let offset = 0 ;
let orderType = ' ASC ' ;
</ script >
< FileList { bucketId } { search } { limit } { offset } { orderType } let:actions let:files >
{ #each files as file }
< p >File: { file . name }</ p >
{ /each }
< button on:click ={ actions . reload ()}>Reload</ button >
</ FileList ><File /> @type - {string}@type - {string} 讓:動作
| 姓名 | 描述 |
|---|---|
download() | 下載文件。 |
view() | 獲取文件以查看。 |
preview(width, height, quality, background, output) | 獲取預覽的文件。 |
update(read, write) | 更新文件。 |
delete() | 刪除文件。 |
< script lang = " ts " >
import { File } from ' metawrite ' ;
// Required
let bucketId : string ;
let fileId : string ;
// OPTIONAL
/** @type {number} */ let width;
/** @type {number} */ let height;
/** @type {string} */ let gravity;
/** @type {number} */ let quality;
/** @type {number} */ let borderWidth;
/** @type {string} */ let borderColor;
/** @type {number} */ let borderRadius;
/** @type {number} */ let opacity;
/** @type {number} */ let rotation;
/** @type {string} */ let background;
/** @type {string} */ let output;
/** @type {string[]} */ let read;
/** @type {string[]} */ let write;
</ script >
< File { bucketId } { fileId } let:actions >
< button on:click ={ actions . download ()}>Download File</ button >
< button on:click ={ actions . view ()}>File View</ button >
< button on:click ={ actions . preview ()}>Preview File</ button >
< button on:click ={ actions . update ( read , write )}>Update File</ button >
< button on:click ={ actions . delete ()}>Delete File</ button >
</ File >功能服務允許您創建可以由任何受支持的AppWrite系統事件或預定義的時間表觸發的自定義行為。
AppWrite Cloud函數使您可以根據AppWrite觸發的事件或通過在預定義的時間表中執行它來自動運行後端代碼。您的代碼以安全的方式存儲在您的AppWrite實例上,並在孤立的環境中執行。
您可以通過遵循AppWrite的雲功能教程了解更多信息。
<Function /> 讓:動作
| 姓名 | 描述 |
|---|---|
reload() | 重新加載。 |
create(functionId, data) | 創建執行。需要functionId , data可能是空字符串,因為可選。 @type {string} |
create(functionId, executionId) | 獲得執行。兩個參數都是必需的。 @type {string} |
< script >
import { Function } from ' metawrite ' ;
let functionId = ' someExecution ' ; // required
let newFunctionId = ' ' ;
let data = ' String of custom data to send to function. ' ; // could be empty string because optional
</ script >
< Function { functionId } { data } let:actions let:executions >
{ #each executions as execution }
< p >
Execution ID: { execution . $id }, Function ID: { execution . functionId }, Date Created: { execution . dateCreated }
</ p >
{ /each }
< input type = "text" name = "functionId" placeholder = "Function ID" bind:value ={ newFunctionId } />
< button on:click ={ actions . create ( newFunctionId , data )}>Create Execution</ button >
</ Function >該語言環境組件允許您根據用戶的位置自定義應用程序。
<Continents /> 讓:動作
| 姓名 | 描述 |
|---|---|
reload() | 重新加載。 |
< script >
import { Continents } from ' metawrite ' ;
</ script >
< Continents let:actions let:continents >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >There are { continents . sum } continents:</ p >
{ #each continents . continents as continent }
< p >{ continent . name }, { continent . code }</ p >
{ /each }
</ Continents ><Countries /> 讓:動作
| 姓名 | 描述 |
|---|---|
reload() | 重新加載。 |
< script >
import { Countries } from ' metawrite ' ;
let eu = true ; // if you want to list only EU countries
</ script >
< Countries let:actions let:countries >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >There are { countries . sum } countries in the world:</ p >
{ #each countries . countries as country }
< p >{ country . name }, { country . code }</ p >
{ /each }
</ Countries >
< Countries { eu } let:actions let:countries >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >There are { countries . sum } countries in EU:</ p >
{ #each countries . countries as country }
< p >{ country . name }, { country . code }</ p >
{ /each }
</ Countries ><Currencies /> 讓:動作
| 姓名 | 描述 |
|---|---|
reload() | 重新加載。 |
< script >
import { Currencies } from ' metawrite ' ;
</ script >
< Currencies let:actions let:currencies >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >There are { currencies . sum } currencies:</ p >
{ #each currencies . currencies as currency }
< p >{ currency . symbol } - { currency . name } ({ currency . code })</ p >
{ /each }
</ Currencies ><Languages /> 讓:動作
| 姓名 | 描述 |
|---|---|
reload() | 重新加載。 |
< script >
import { Languages } from ' metawrite ' ;
</ script >
< Languages let:actions let:languages >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >There are { languages . sum } languages:</ p >
{ #each languages . languages as language }
< p >{ language . name }, { language . code }></ p >
{ /each }
</ Languages ><Locale /> 讓:動作
| 姓名 | 描述 |
|---|---|
reload() | 重新加載。 |
object < script >
import { Locale } from ' metawrite ' ;
</ script >
< Locale let:actions let:code >
< h1 >Active Session</ h1 >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >Location: { code . country }, { code . continentCode }</ p >
< p >IP: { code . ip }</ p >
</ Locale ><PhoneCodes /> 讓:動作
| 姓名 | 描述 |
|---|---|
reload() | 重新加載。 |
< script >
import { PhoneCodes } from ' metawrite ' ;
</ script >
< PhoneCodes let:actions let:codes >
< button on:click ={ actions . reload ()}>Reload</ button >
< p >There are { codes . sum } phone codes:</ p >
{ #each codes . phones as phone }
< p >{ phone . code } - { phone . countyName }></ p >
{ /each }
</ PhoneCodes >