Skip to content
Giao diện chuẩn Built for Shopify. Có sẵn ngay.

Shopify Polaris.
Có type cho Vue 3.

Các component Vue 3 có type cho Polaris web components của Shopify (s-button, s-text-field, s-modal, ...), không cần học thêm một design system riêng cho Vue.

<STextField v-model="name" />
<SButton variant="primary">Save</SButton>

Vue 3 wrapper cho Shopify Polaris

Trọn vẹn Polaris. Không phải học lại.

62

Props & events có type

Props và events của mọi wrapper được generate từ Custom Elements Manifest chính thức của Shopify, nên bạn có autocomplete và type-check khớp với API thật của component.

17

v-model trên 17 form component

Text field, checkbox, switch, select, choice list, date picker và nhiều component khác đều hỗ trợ v-model sẵn, được map đúng cặp prop/event bên dưới của từng element.

Không bao giờ chặn bạn

Prop lạ được truyền thẳng qua $attrs, nội dung slot được chuyển nguyên vẹn. Wrapper cũ không bao giờ làm hỏng code đang chạy, chỉ thiếu type cho tính năng mới.

Đồng bộ với manifest

Định nghĩa component và type được generate trực tiếp từ Custom Elements Manifest của Shopify, giữ cho wrapper luôn khớp với runtime Polaris trên CDN.

Polaris web components, có type cho Vue ​

Polaris web components của Shopify (<s-button>, <s-text-field>, <s-modal>, …) chạy được với mọi framework, nhưng trong template Vue chúng chỉ là custom element không có type: không autocomplete, không kiểm tra prop, và không có v-model. polaris-vue-elements bọc từng element trong một Vue 3 component mỏng, được generate từ Custom Elements Manifest của Shopify, còn runtime Polaris vẫn được tải từ CDN của Shopify.

vue
<script setup lang="ts">
import { ref } from 'vue'
import { SButton, STextField } from 'polaris-vue-elements'

const name = ref('')
</script>

<template>
  <STextField v-model="name" label="Store name" />
  <SButton variant="primary">Save</SButton>
</template>

Tất cả components ​

Phát hành theo giấy phép MIT. Logo Vue của Evan You, CC BY-NC-SA 4.0.