npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

x-components-plus

v0.1.3

Published

A Vue components which you can all beleive in.

Readme

Install

  1. Install the remote package to the local
npm install x-components-plus
  1. Import all or batch import
  • Import all

main.ts or main.js

import xComponentsPlus from 'x-components-plus' 
createApp(App).use(xComponentsPlus).mount('#app') 
  • Batch import

normal vue files

<script setup>
import { xButton } from 'x-components-plus'
</script>
<template> 
  <xButton> button </xButton> 
</template>
  1. Import style

main.ts or main.js

import 'x-components-plus/style.css'

Use of Components

x-row

  1. Props

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | justify | false | string | the options like the justify-content in css | flex-start | Horizontal position| | align | false | string | the options like the align-content in css | center | Vertical position|

  1. Event
  2. Slot

| name | returned parameters | tip | | :-: | :-: | :-: | | defalut | no params | default solt |

  1. Usage
<script setup>
import { xRow } from 'x-components-plus'
import { xCol } from 'x-components-plus'
</script>
<template>
  <xRow justify="center" align="center">
    <xCol>123</xCol>
  </xRow>
</template>

x-col

  1. Props

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | span | false | number | the number bigger than 0 | 24 | the size of the occupied position (span / 24 * 100%) |

  1. Event
  2. Slot

| name | returned parameters | tip | | :-: | :-: | :-: | | defalut | no params | default solt |

  1. Usage
<script setup>
import { xRow } from 'x-components-plus'
import { xCol } from 'x-components-plus'
</script>
<template>
  <xRow justify="center" align="center">
    <xCol>123</xCol>
  </xRow>
</template>

x-button

  1. Props

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | type | false | string | primary, normal | normal | button type | | radius | false | number | number > 0 | 10 | button radius | | size | false | string | mini, normal, middle, large | normal | button size | | color | false | string | black, white, green | black | font color | | disabled | false | boolean | true, false | false | button disable | | bgcColor | false | string | - | - | button background color | | label | false | string | - | - | button label |

  1. Event
  2. Slot

| name | returned parameters | tip | | :-: | :-: | :-: | | defalut | no params | default solt |

  1. Usage
<script setup>
import { xButton } from 'x-components-plus'
</script>
<template>
  <xButton type="primary">
    <template> <span> button label </span> </template>
  </xButton>
</template>

x-calendar

  1. Props

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | modelValue | false | number | - | +new Date() | timestamp | | hasHeader | false | boolean | true, false | true | display default header | | hasFooter | false | boolean | true, false | true | display default footer | | hasSchedule | false | boolean | true, false | true | click date and jump to the schedule |

  1. Event

| name | tip| | :-: | :-: | | update:modelValue | update modelValue | | changeDate | (selectedDate) => {} | | addSchedule | () => {} | | addedSchedule | (newSchedule) => {} |

  1. Slot
  2. Usage
<script setup>
import { xCalendar } from 'x-components-plus'
</script>
<template>
  <xCalendar> </xCalendar>
</template>

x-carouselChart

  1. Props

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | imgList | true | string[] | - | - | collection of images | | wHRatio | false | number | - | 3 / 2 | the ratio of (width / height) | | width | false | number | - | 600 | container width | | height | false | number | - | 200 | container height | | defaultDir | false | string | left, right | left | the rotate direction | | showDelay | false | number | - | 3000 | Interval time | | moveDelay | false | number | - | 500 | picture moving time | | borderRadius | false | string | - | 20px | picture radius |

  1. Event

| name | tip| | :-: | :-: | | imgClick | (imgIndex, imgSrc) => {} |

  1. Slot
  2. Usage
<script setup>
import { xCarouselChart } from 'x-components-plus'
import { ref } from "vue";

const img = ref(['url1', 'url2', 'url2'])
</script>
<template>
  <carouselChart
    :imgList="img"
  >
  </carouselChart>
</template>

x-checkbox

  1. Props

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | modelValue | false | boolean | true, false | false | checkbox initial value | | label | true | string, number | - | - | checkbox label | | checkType | false | string | all, notAll | all | checkbox selected display | | checked | false | boolean | true, fasle | false | change checkbox initial type | | restParams | fasle | any | - | - | some times, we need to distinguish the callback value, we can set this field to work | | disabled | false | boolean | true, false | false | checkbox disable | | showSelectBox | false | boolean | true, false | true | if show the box before label |

  1. Event

| name | tip| | :-: | :-: | | update:modelValue | update modelValue | | change | (newValue, oldValue, restParams) => {} |

  1. Slot

| name | returned parameters | tip | | :-: | :-: | :-: | | label | no params | label solt |

  1. Usage
<script lang="ts" setup>
import { ref } from 'vue'
import { xCheckbox } from 'x-components-plus'

const xCheckboxValue = ref(false)
const checkBoxChenge = (val: any, oldVal: any) => {
	console.log('checkBoxChenge', val, oldVal)
}
</script>
<template>
	<xCheckbox
		v-model="xCheckboxValue"
		@change="checkBoxChenge"
		:label="'xCheckboxLabel'"
		checked
		:check-type="'notAll'"
	></xCheckbox>
</template>

x-checkboxGroup

  1. Props

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | modelValue | false | string[], number[] | - | [] | checkboxGroup initial value |

  1. Event

| name | tip| | :-: | :-: | | update:modelValue | update modelValue | | change | (modelValue, itemLabel, itemNewValue) => {} |

  1. Slot

| name | returned parameters | tip | | :-: | :-: | :-: | | defalut | no params | default solt |

  1. Usage
<script lang="ts" setup>
import { xCheckboxGroup, xCheckbox } from 'x-components-plus'
import { ref } from 'vue'

const checkBoxGroupValue = ref(['xCheckboxLabel1', 'xCheckboxLabel3'])
const checkBoxGroupChenge = (val: any, label: any, type: boolean) => {
	console.log('checkBoxGroupChenge', val, label, type)
}
const checkBoxChenge = (val: any, oldVal: any) => {
	console.log('checkBoxChenge', val, oldVal)
}
</script>
<template>
	<xCheckboxGroup @change="checkBoxGroupChenge" v-model="checkBoxGroupValue">
		<xCheckbox @change="checkBoxChenge" :label="'xCheckboxLabel1'"></xCheckbox>
		<xCheckbox @change="checkBoxChenge" :label="'xCheckboxLabel2'"></xCheckbox>
		<xCheckbox @change="checkBoxChenge" :label="'xCheckboxLabel3'"></xCheckbox>
		<xCheckbox @change="checkBoxChenge" :label="'xCheckboxLabel4'"></xCheckbox>
		<xCheckbox @change="checkBoxChenge" :label="'xCheckboxLabel5'"></xCheckbox>
	</xCheckboxGroup>
</template>

x-dialog

  1. Props

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | port | false | string | element tag name, id, class... | body | the dialog will be mounted on the element | | modelValue | true | boolean | trye, false | - | control the dialog display | | width | false | string | persent | 60% | the dialog width | | title | false | string | - | - | the dialog title |

  1. Event

| name | tip| | :-: | :-: | | update:modelValue | update modelValue |

  1. Slot

| name | returned parameters | tip | | :-: | :-: | :-: | | header | no params | slot in the header | | default | no params | slot in the body | | footer | no params | slot in the footer |

  1. Usage
<script lang="ts" setup>
import { ref } from 'vue'
import { xDialog, xButton } from 'x-components-plus'

const visible = ref(false)
const open = () => {
	visible.value = true
}
</script>
<template>
	<xButton @click="open">open dialog</xButton>
	<xDialog v-model="visible">
		<div style="padding: 10px">
			<h1>Dialog body.</h1>
		</div>
	</xDialog>
</template>

x-input

  1. Props

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | modelValue | false | string, number | - | '' | input value | | placeholder | false | string | - | please input | input placeholder | | size | false | string | mini, normal, middle, large | normal | input size | | clearable | false | boolean | true, false | true | display the button to clear all content | | inputWidth | false | number, string | persent | 100% | input width | | focusCallback | false | Function | - | () => { } | input focus callback | | blurCallback | false | Function | - | () => { } | input blur callback | | vaildCallback | false | Function | - | (val) => val | input vaild callback |

  1. Event

| name | tip| | :-: | :-: | | update:modelValue | update modelValue | | change | (newValue) => {} | | input | (newValue) => {} |

  1. Slot

| name | returned parameters | tip | | :-: | :-: | :-: | | rightIcon | no params | change clear icon |

  1. Usage
<script lang="ts" setup>
import { ref } from 'vue'
import { xInput } from 'x-components-plus'

const value = ref('123')
</script>
<template>
	<xInput v-model="value"> </xInput>
</template>

x-inputSearch

  1. Props

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | searchEvent | false | Function | - | () => [] | search logic in this function | | clickEvent | false | Function | - | () => {} | list item click event | | keyWord | true | string | - | - | the item in list which return by the searchEvent, will contain the keyWord as one of the keys. if match, the value will display |

  1. Event
  2. Slot
  3. Usage
<script lang="ts" setup>
import { ref } from 'vue'
import { xInputSearch } from 'x-components-plus'

const searchEvent = () => {
  return [
    {
      value: 1
    },
    {
      value: 2
    },
  ]
}
</script>
<template>
	<xInputSearch :keyWord="'value'"> </xInputSearch>
</template>

x-navLinkage

  1. Props
type dataItem = {
    id: string,
    title: string,
    disabled?: boolean,
  }

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | data | true | dataItem[] | - | - | initial value | | disabled | false | boolean | true, false | false | disable the hole left navigation |

  1. Event
  2. Slot

| name | returned parameters | tip | | :-: | :-: | :-: | | 'xNav' + dataItem.id | no params | slot in the left navigation items | | 'xContent' + dataItem.id | no params | slot in the right container items |

  1. Usage
<script lang="ts" setup>
import { ref } from 'vue'
import { xNavLinkage } from 'x-components-plus'

const data = ref<any[]>([]);
for (let i = 0; i < 30; i++) {
  data.value.push({
    id: i.toString(),
    title: `title${i}`,
  });
}
</script>
<template>
	<xNavLinkage :data="data" :disabled="false">
    <template v-for="(item, index) in data" v-slot:[`xContent${item.id}`]="scoped">
      <div :key="item.id" :style="{ backgroundColor: `rgba(0, 0, 0, ${(10 - index * 3) / 10})`, width: '400px' }">
        <textarea name="" id="" :rows="index" :value="item.title"></textarea>
      </div>
    </template>
  </xNavLinkage>
</template>

x-portrait

  1. Props

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | src | false | string | - | '' | image src |

  1. Event
  2. Slot

| name | returned parameters | tip | | :-: | :-: | :-: | | default | - | hover on the portrait, will display the sloted structure |

  1. Usage
<script lang="ts" setup>
import { ref } from 'vue'
import { xPortrait } from 'x-components-plus'
</script>
<template>
	<xPortrait>
    <div class="portrait-container">
      <h1>portrait options</h1>
    </div>
  </xPortrait>
</template>

x-scroll

  1. Props
  2. Event

| name | tip| | :-: | :-: | | handleScrollY | (scrollTop) => {} |

  1. Slot

| name | returned parameters | tip | | :-: | :-: | :-: | | default | - | the inner structure in the container |

  1. Usage
<script lang="ts" setup>
import { ref } from 'vue'
import { xScroll } from 'x-components-plus'

const xScrollRef = ref();

xScrollRef.value.xScrollEvent({
  top: 0,
  left: 0,
});
</script>
<template>
	<xScroll ref="xScrollRef">
    <div v-for="item in 3" :key="item" style="width: 100px; height: 200px"></div>
  </xScroll>
</template>

x-select

  1. Props
type optionsItemType = {
  label: string | number;
  value: string | number | boolean;
}

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | modelValue | true | string, number, boolean, string[], number[], boolean[] | - | - | select value | | multiple | false | boolean | true, false | false | multiple select | | placeholder | false | string | - | - | select placeholder | | size | false | string | mini, normal, middle, large | normal | select input size | | clearable | false | boolean | true, false | true | display the button to clear all content | | inputWidth | false | number, string | - | - | select input width | | options | false | optionsItemType[] | - | [] | options of select | | search | false | boolean | true, false | true | filter by input content |

  1. Event

| name | tip| | :-: | :-: | | update:modelValue | update modelValue | | change | (newValue, oldValue, optionsItem) => {} |

  1. Slot
  2. Usage
<script lang="ts" setup>
import { ref } from 'vue'
import { xSelect } from 'x-components-plus'

const value = ref('')
const options = ref([
	{
		label: '123wdq',
		value: 0,
	},
	{
		label: 'dwe',
		value: 1,
	},
	{
		label: 'da',
		value: 2,
	},
])
</script>
<template>
	<xSelect v-model="value" :options="options" :multiple="true">123</xSelect>
</template>

x-sort

  1. Props
type DataType = {
	id: string;
	name: string;
}

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | direction | false | string | row, column | row | layout direction | | span | false | number | - | 3 | the count of items in main direction | | itemWidth | true | number | - | - | width of item | | itemHeight | true | number | - | - | height of item | | data | true | DataType[] | - | - | the collection of sorted items | | isDelay | false | boolean | true, false | false | when drag one, others will be resort in a delay time |

  1. Event
  2. Slot

| name | returned parameters | tip | | :-: | :-: | :-: | | 'xSort' + DataType.id | item, index | slot in the item |

  1. Usage
<script lang="ts" setup>
import { ref } from 'vue'
import { xSort } from 'x-components-plus'

const data = ref<any[]>([]);
for (let i = 0; i < 64; i++) {
  data.value.push({
    id: i + "",
    name: "item" + i,
  });
}
const xSortRef = ref();
const deleteItem = (scoped: any) => {
  xSortRef.value.deleteItem(scoped.item.id);
};
const addItem = (scoped: any, flag: boolean) => {
  const newItem = {
    id: data.value.length + "",
    name: "item" + data.value.length,
  }
  data.value.push(newItem);
  xSortRef.value.addItem(scoped.item.id, newItem, flag);
};
const width = ref(100);
const height = ref(30);
const getSortedData = () => {
  console.log(xSortRef.value.getSortedData())
}
</script>
<template>
  <xSort ref="xSortRef" :data="data" :direction="'row'" :item-width="width" :item-height="height"
    :span="8">
    <template v-for="(item, index) in data" v-slot:[`xSort${item.id}`]="scoped">
      <div :key="item.id" style="
        border: 1px solid #ccc;
        display: flex;
        justify-content: space-around;
        align-items: center;
        margin: 0 5px;
      ">
        <span style="cursor: pointer" @click="addItem(scoped, false)">+</span>
        {{ item.name }}
        <span style="cursor: pointer" @click="addItem(scoped, true)">+</span>
        <span style="cursor: pointer" @click="deleteItem(scoped)">x</span>
      </div>
    </template>
  </xSort>
</template>

x-tab

  1. Props
type dataType = {
  id: string;
  name: string;
}

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | data | true | dataType[] | - | - | the collection of tab items | | height | false | number | - | 30 | tab item height |

  1. Event

| name | tip| | :-: | :-: | | addTab | (callback) => { const newItem = {...}; callback(newItem); } |

  1. Slot

| name | returned parameters | tip | | :-: | :-: | :-: | | 'xNav' + dataType.id | - | slot in the tab item | | 'xContent' + dataType.id | - | slot in the container item | | xAddButton | - | slot in the add button |

  1. Usage
<script lang="ts" setup>
import { ref } from 'vue'
import { xTab } from 'x-components-plus'

const data = ref<any[]>([]);
for (let i = 0; i < 1; i++) {
  data.value.push({
    id: i + "",
    name: "tab" + i,
  });
}
const xTabRef = ref();
const height = ref(30);
const addTab = (callback: Function) => {
  const newTab = {
    id: data.value.length,
    name: "tab" + data.value.length,
  };
  data.value.push(newTab);
  callback(newTab);
};
</script>
<template>
  <xTab :data="data" :height="height" ref="xTabRef" @add-tab="addTab">
    <template v-for="item in data" v-slot:[`xContent${item.id}`]="scoped">
      <div :key="item.id">this is tab content {{ item.name }}</div>
    </template>
  </xTab>
</template>

x-table

  1. Props
type tablePropsItem = {
  prop?: string; (key name of item)
  label: string; (colum title)
  width?: number; (colum width)
  colspan?: number; (colum colspan)
  textAlign?: 'left' | 'center' | 'right'; (content layout)
  children?: tablePropsItem[]; (subscript level title)
  isSlot?: boolean; (need to insert content by writer)
  fixed?: boolean; (fixed colum)
}

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | tableProps | true | tablePropsItem[] | - | [] | table options | | tableData | true | Record<string, any>[] | - | [] | table data | | textAlign | false | string | left, center, right | center | table content text align | | tableWidth | false | string, number | - | 100% | table container width | | tableHeight | false | string, number | - | 500 | table container height |

  1. Event
  2. Slot

| name | returned parameters | tip | | :-: | :-: | :-: | | tablePropsItem.prop | prop, row, rowIndex, colIndex | slot in the table cell content |

  1. Usage
<script lang="ts" setup>
import { ref } from 'vue'
import { xTable } from 'x-components-plus'

const tableProps = ref([
  {
    prop: "name",
    label: "名字",
    width: 150,
    isSlot: true,
    // fixed: true,
  },
  {
    prop: "age",
    label: "年龄",
  },
  {
    label: "地址",
    width: 250,
    children: [
      {
        prop: "p",
        label: "省份",
        width: 150,
      },
      {
        label: "城市",
        width: 100,
        children: [
          {
            prop: "q",
            label: "区",
            width: 50,
          },
          {
            label: "镇",
            children: [
              {
                prop: "c",
                label: "村",
                width: 50,
              },
              {
                prop: "z",
                label: "组",
                width: 150,
              },
            ],
          },
        ],
      },
    ],
  },
]);
const tableData = ref([
  {
    name: "Bob",
    age: "18",
    address: "武汉市",
    p: "p1fwfew",
    q: "q1",
    z: "z1fwefgrgrgt",
    c: "c1cwecwefwev",
  },
  {
    name: "小明",
    age: "30",
    address: "北京市",
    p: "p2",
    q: "q2fewfwefw",
    z: "z2grgrtgr",
    c: "c2",
  },
  {
    name: "小明",
    age: "30",
    address: "北京市",
    p: "p2",
    q: "q2fewfwefw",
    z: "z2grgrtgr",
    c: "c2",
  }
])
</script>
<template>
  <xTable
    :tableProps="tableProps"
    :tableHeight="400"
    :tableWidth="900"
    :tableData="tableData"
  >
    <template #name="scoped">
      name: {{ scoped.prop }}
    </template>
  </xTable>
</template>

x-tooltip

  1. Props

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | placement | false | string | top, bottom, left, right | top | display direction | | content | false | string | - | '' | tip content | | modelValue | false | boolean | true, false | false | control the tooltip display | | from | false | string | - | common | a params for the v-showSpanTooltip | | width | false | string | - | 150px | tooltip width | | mouseenterCallback | false | Function | - | () => {} | when mouseenter, will callback this function | | mouseleaveCallback | false | Function | - | () => {} | when mouseleave, will callback this function |

  1. Event
  2. Slot

| name | returned parameters | tip | | :-: | :-: | :-: | | default | trigger element | | tip | tip content |

  1. Usage
<script lang="ts" setup>
import { xTooltip } from 'x-components-plus'
</script>
<template>
  <xTooltip
    ref="xTooltipRef"
    :content="tooltip show"
  >
    <h3>hover me</h3>
  </xTooltip>
</template>

x-tree

  1. Props
type xTreeDataItem = {
  [prop: string | number]: any;
  children?: xTreeDataItem[];
}

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | data | true | xTreeDataItem[] | - | [] | tree data | | selectDisabled | false | boolean | true, false | false | disable to select tree | | selected | false | string[], number[] | - | [] | set initial selected value | | treeKey | true | keyof xTreeDataItem | - | - | the key of the xTreeDataItem | | treeLabel | true | keyof xTreeDataItem | - | - | the label of the xTreeDataItem | | getSelectedRoot | false | boolean | true, false | false | when change select, will add the selectedRootNode in the change event params | | getSelectedFinal | false | boolean | true, false | false | when change select, will add all the leaveNode in the change event params | | getSelectedAll | false | boolean | true, false | false | when change select, will add all the selectedNode in the change event params | | showSelectBox | false | boolean | true, false | true | display the select box |

  1. Event

| name | tip| | :-: | :-: | | change | (newValue, oldValue, changedItem, level, callbackData) => { } | | labelClick | (clickedItem) => { } |

  1. Slot

| name | returned parameters | tip | | :-: | :-: | :-: | | label | - | tree item label |

  1. Usage
<script lang="ts" setup>
import { xTree } from 'x-components-plus'

const treeChange = (
	nv: boolean,
	ov: boolean,
	treenode: any,
	level: number,
	callbackData: Record<string, any>
) => {
	console.log(
		nv,
		ov,
		treenode,
		level,
		callbackData.getSelectedRoot,
		callbackData.getSelectedFinal
	)
}
const treeData = ref([
	{
		label: '1',
		value: '1',
		children: [
			{
				label: '1-1',
				value: '1-1',
			},
			{
				label: '1-2',
				value: '1-2',
				children: [],
			},
		],
	},
	{
		label: '2',
		value: '2',
	},
	{
		label: '3',
		value: '3',
		children: [
			{
				label: '3-1',
				value: '3-1',
				children: [
					{
						label: '3-1-1',
						value: '3-1-1',
						children: [
							{
								label: '3-1-1-1',
								value: '3-1-1-1',
								children: [],
							},
							{
								label: '3-1-1-2',
								value: '3-1-1-2',
								children: [],
							},
							{
								label: '3-1-1-3',
								value: '3-1-1-3',
								children: [],
							},
						],
					},
					{
						label: '3-1-2',
						value: '3-1-2',
					},
				],
			},
			{
				label: '3-2',
				value: '3-2',
				children: [
					{
						label: '3-2-1',
						value: '3-2-1',
						children: [
							{
								label: '3-2-1-1',
								value: '3-2-1-1',
								children: [],
							},
							{
								label: '3-2-1-2',
								value: '3-2-1-2',
								children: [],
							},
							{
								label: '3-2-1-3',
								value: '3-2-1-3',
								children: [],
							},
						],
					},
					{
						label: '3-2-2',
						value: '3-2-2',
					},
				],
			},
		],
	},
])
</script>
<template>
	<xTree
		:data="treeData"
		:treeKey="'value'"
		:treeLabel="'label'"
		:selected="['2', '3-1-1']"
		@change="treeChange"
		getSelectedRoot
		getSelectedFinal
	></xTree>
</template>

x-virtualList

  1. Props
type orderItem = {
  prop: string; (key of item)
  width?: number | string;
}

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | listOrder | true | orderItem[] | - | [] | list title | | listData | true | Record<string, any>[] | - | [] | list body data | | height | false | number | - | 500 | list height | | lineHeight | false | number | - | 50 | list item height | | activeKey | false | string | - | - | one of keys of listData item | | activeValues | false | any[] | - | - | collection of activeValue of listData item |

  1. Event

| name | tip| | :-: | :-: | | change | (dataItem, dataIndex, orderItem, orderIndex) => { } |

  1. Slot

| name | returned parameters | tip | | :-: | :-: | :-: | | orderItem.prop | row, index, lineIndex, xVirtualListRefScrollTop | tree item label |

  1. Usage
<script lang="ts" setup>
import { xVirtualList } from 'x-components-plus'
import { ref } from "vue";

const listOrder = ref([
  {
    prop: "p1",
    width: "100%",
  },
  {
    prop: "p2",
    width: "100%",
  },
  {
    prop: "p3",
    width: "100%",
  },
]);
const key = ref(0);
const listData = ref<any>([]);
const setData = () => {
  listData.value = [];
  for (let index = 0; index < 100; index++) {
    listData.value.push({
      p1: "index:" + index,
      p2: index,
      p3: index % 2,
    });
  }
  key.value++;
};

setData();
</script>
<template>
  <xVirtualList
    style="margin: 30px; border: 1px #ddd solid"
    :listOrder="listOrder"
    :listData="listData"
    :lineHeight="45"
    :height="380"
    :key="key"
  >
    <template #p2="scoped">
      <xButton @click="add(scoped.row)">按钮</xButton>
    </template>
    <template #p3="scoped">
      <xInput v-model="scoped.row.p3" />
    </template>
  </xVirtualList>
</template>

x-message

  1. Props

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | message | true | string, number | - | '' | the message of tip | | during | false | number | - | 2000 | delay time |

  1. Usage
<script lang="ts" setup>
xMessage({
  message: response.message,
  during: 1000,
});
</script>

x-prompt

  1. Props

| name | required | type | Optional | default | tip| | :-: | :-: | :-: | :-: | :-: | :-: | | title | true | number, string | - | - | prompt title | | message | true | number, string | - | - | prompt message | | confirmText | true | string | - | - | confirm button text | | cancelText | true | string | - | - | cancel button text |

  1. Usage
<script lang="ts" setup>
xPrompt({
  title: "Tip",
  message: "Please confirm",
  confirmText: "Confirm",
  cancelText: "Cancel",
}).then(() => {
  console.log("Confirm!")
}).catch(() => {
  console.log("Cancel!")
})
</script>

Use of Directives

loadding

<script lang="ts" setup>
import { ref } from "vue";
import { loadding } from "x-components-plus"

const vLoadding = loadding
const loaddingShow = ref(true)
</script>
<template>
  <div v-loadding="loaddingShow"></div>
</template>

pageCut

<script lang="ts" setup>
import { ref, reactive } from "vue";
import { pageCut } from "x-components-plus"

const vPageCut = pageCut
const pageCutObj = reactive({
	callback: (blob: Blob) => {
		pageCutShow.value = false
    console.log(blob)
	},
	errorCallback: (val: boolean) => {
		pageCutShow.value = false
		console.log(val)
	},
})
const pageCutShow = ref(false)
document.addEventListener('click', () => {
  pageCutShow.value = true
})
</script>
<template>
  <div v-pageCut:[pageCutObj]="pageCutShow"></div>
</template>