• UI组件库Kendo UI for Vue原生组件中文 - 按钮概述


    Kendo UI for Vue Buttons包提供了代表用户可以采取的简单操作的触发器组件。

    Buttons package是Kendo UI for Vue库的一部分,它为Vue生态系统提供原生的Kendo UI for Vue组件,可在kendo-vue-buttons NPM 包下使用。

    注意:Buttons Package 是 Kendo UI for Vue 的一部分,这是一个专业级的 UI 库,包含 90 多个组件,用于构建现代且功能丰富的应用程序。 要试用它,请点击下方按钮获取。

    Kendo UI最新官方正式版下载

    基本用法

    以下示例演示了 Buttons 包中的所有组件的实际操作。

    main.vue

    1. <template>
    2. <div class="example-wrapper">
    3. <div class="example-col">
    4. <p>Buttonp>
    5. <kbutton>Defaultkbutton>
    6. <kbutton :theme-color="'primary'">Primarykbutton>
    7. <kbutton :disabled="true">Disabledkbutton>
    8. div>
    9. <div class="example-col">
    10. <p>ButtonGroupp>
    11. <buttongroup>
    12. <kbutton toggleble="true"> Option A kbutton>
    13. <kbutton toggleble="true"> Option B kbutton>
    14. <kbutton toggleble="true"> Option C kbutton>
    15. buttongroup>
    16. div>
    17. <div class="example-col">
    18. <p>DropDownButtonp>
    19. <dropdownbutton
    20. :text-field="'actionName'"
    21. :icon="'cog'"
    22. :items="dropDownButtonItems"
    23. :text="'Edit'"
    24. >dropdownbutton>
    25. div>
    26. <div class="example-col">
    27. <p>SplitButtonp>
    28. <splitbutton :text="'Paste'" :icon="'paste'" :items="splitButtonItems">
    29. splitbutton>
    30. div>
    31. <div>
    32. <p>Toolbarp>
    33. <toolbar>
    34. <toolbaritem>
    35. <buttongroup>
    36. <kbutton
    37. :icon="'bold'"
    38. :title="'Bold'"
    39. :togglable="true"
    40. >kbutton>
    41. <kbutton
    42. :icon="'italic'"
    43. :title="'Italic'"
    44. :togglable="true"
    45. >kbutton>
    46. <kbutton
    47. :icon="'underline'"
    48. :title="'Underline'"
    49. :togglable="true"
    50. >kbutton>
    51. buttongroup>
    52. toolbaritem>
    53. <toolbarseparator />
    54. <toolbaritem>
    55. <buttongroup>
    56. <kbutton
    57. :icon="'align-left'"
    58. :title="'Align Left'"
    59. :togglable="true"
    60. >kbutton>
    61. <kbutton
    62. :icon="'align-center'"
    63. :title="'Align Center'"
    64. :togglable="true"
    65. >kbutton>
    66. <kbutton
    67. :icon="'align-right'"
    68. :title="'Align Right'"
    69. :togglable="true"
    70. >kbutton>
    71. <kbutton
    72. :icon="'align-justify'"
    73. :title="'Align Justify'"
    74. :togglable="true"
    75. >kbutton>
    76. buttongroup>
    77. toolbaritem>
    78. <toolbarseparator />
    79. <toolbaritem>
    80. <kbutton :icon="'cut'" :title="'Cut'">Cutkbutton>
    81. toolbaritem>
    82. <toolbarseparator />
    83. <toolbaritem>
    84. <kbutton :icon="'copy'" :title="'Copy'">Copykbutton>
    85. toolbaritem>
    86. <toolbarseparator />
    87. <toolbaritem>
    88. <kbutton :icon="'paste'" :title="'Paste'">Pastekbutton>
    89. toolbaritem>
    90. toolbar>
    91. <p>Chip and ChipListp>
    92. <chiplist :rounded="'full'" :default-data-items="people" :selection="'single'" :chip="chip">
    93. <template v-slot:myTemplate="{ props }">
    94. <custom
    95. :data-item="props.dataItem"
    96. :value="props.value"
    97. :text="props.text"
    98. />
    99. template>
    100. chiplist>
    101. div>
    102. <div class="example-col">
    103. <fab
    104. :icon="'check'"
    105. :text="'Floating Action Button'"
    106. :align="{ horizontal: 'start', vertical: 'bottom' }"
    107. >fab>
    108. div>
    109. div>
    110. template>
    111. <script>
    112. import {
    113. Button,
    114. ButtonGroup,
    115. ChipList,
    116. DropDownButton,
    117. FloatingActionButton,
    118. Toolbar,
    119. ToolbarItem,
    120. ToolbarSeparator,
    121. SplitButton,
    122. } from "@progress/kendo-vue-buttons";
    123. import CustomChip from "./CustomChip";
    124. const people = [
    125. {
    126. text: "Pedro Afonso",
    127. value: "pedro",
    128. icon: "k-chip-avatar pedro",
    129. },
    130. {
    131. text: "Thomas Hardy",
    132. value: "thomas",
    133. icon: "k-chip-avatar thomas",
    134. },
    135. {
    136. text: "Christina Berg",
    137. value: "christina",
    138. icon: "k-chip-avatar christina",
    139. },
    140. {
    141. text: "Paula Wilson",
    142. value: "paula",
    143. icon: "k-chip-avatar paula",
    144. },
    145. ];
    146. const editItems = [
    147. {
    148. actionName: "Undo",
    149. icon: "undo",
    150. },
    151. {
    152. actionName: "Redo",
    153. icon: "redo",
    154. disabled: true,
    155. },
    156. {
    157. actionName: "Cut",
    158. icon: "cut",
    159. },
    160. {
    161. actionName: "Copy",
    162. icon: "copy",
    163. },
    164. {
    165. actionName: "Paste",
    166. icon: "paste",
    167. },
    168. ];
    169. const pasteItems = [
    170. { text: "Keep Text Only", icon: "paste-plain-text" },
    171. { text: "Paste as HTML", icon: "paste-as-html" },
    172. { text: "Paste Markdown", icon: "paste-markdown" },
    173. { text: "Set Default Paste" },
    174. ];
    175. export default {
    176. components: {
    177. "kbutton": Button,
    178. buttongroup: ButtonGroup,
    179. fab: FloatingActionButton,
    180. chiplist: ChipList,
    181. custom: CustomChip,
    182. dropdownbutton: DropDownButton,
    183. toolbar: Toolbar,
    184. toolbaritem: ToolbarItem,
    185. toolbarseparator: ToolbarSeparator,
    186. splitbutton: SplitButton,
    187. },
    188. data() {
    189. return {
    190. people: people,
    191. chip: "myTemplate",
    192. dropDownButtonItems: editItems,
    193. splitButtonItems: pasteItems,
    194. };
    195. },
    196. };
    197. script>
    198. <style scoped>
    199. .k-chip {
    200. margin-right: 10px;
    201. }
    202. .pedro {
    203. background-image: url("https://demos.telerik.com/kendo-ui/content/web/Customers/SPLIR.jpg");
    204. }
    205. .thomas {
    206. background-image: url("https://demos.telerik.com/kendo-ui/content/web/Customers/RICSU.jpg");
    207. }
    208. .christina {
    209. background-image: url("https://demos.telerik.com/kendo-ui/content/web/Customers/BERGS.jpg");
    210. }
    211. .paula {
    212. background-image: url("https://demos.telerik.com/kendo-ui/content/web/Customers/RATTC.jpg");
    213. }
    214. .custom-style {
    215. color: #6200ee;
    216. background-color: #f3ebfe;
    217. border-color: #6200ee;
    218. }
    219. .k-button {
    220. margin-right: 3px;
    221. }
    222. .k-button-group > .k-button {
    223. margin-right: 0px;
    224. }
    225. .k-button > .k-image {
    226. width: 20px;
    227. height: 20px;
    228. }
    229. style>

    CustomChip.vue

    1. <template>
    2. <chip
    3. :rounded="'full'"
    4. :data-item="dataItem"
    5. :icon="dataItem.icon"
    6. :text="text"
    7. :value="value"
    8. :removable="true"/>
    9. template>
    10. <script>
    11. import { Chip } from '@progress/kendo-vue-buttons';
    12. export default {
    13. name: 'CustomChip',
    14. components: {
    15. 'chip': Chip,
    16. },
    17. props: {
    18. dataItem: Object,
    19. value: String,
    20. text: String
    21. }
    22. }
    23. script>

    main.js

    1. import { createApp } from 'vue'
    2. import App from './main.vue'
    3. createApp(App).mount('#app')

    安装

    要初始化按钮,请执行以下任一操作:

    • 使用 CDN 服务,或
    • 使用 Webpack。

    使用CDN

    要使用带有 CDN 的Kendo UI for Vue Native Buttons,请按照以下步骤操作:

    1. 引用buttons package。

    <script src="https://unpkg.com/@progress/kendo-vue-buttons@latest/dist/cdn/js/kendo-vue-buttons.js">script>

    2. 应用其中一个Kendo UI主题来为您的组件设置样式。

    1. // Load the Kendo Default Theme
    2. <link rel="stylesheet" href="https://unpkg.com/@progress/kendo-theme-default@latest/dist/all.css">
    3. // Load the Kendo Bootstrap Theme
    4. <link rel="stylesheet" href="https://unpkg.com/@progress/kendo-theme-bootstrap@latest/dist/all.css">
    5. <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
    6. // To load the Kendo Material Theme
    7. <link rel="stylesheet" href="https://unpkg.com/@progress/kendo-theme-material@latest/dist/all.css">

    3. 按照步骤激活您的产品授权许可,如果您的应用程序已包含许可证密钥,则可以跳过此步骤。

    使用 Webpack 初始化

    1. 下载并安装软件包,使用 Node.js v5.0.0 或更高版本。

    npm install --save @progress/kendo-vue-buttons @progress/kendo-licensing

    2. 安装后,导入package模块。

    // ES2015 module syntax
    import { Button, ButtonGroup, Chip, ChipList, DropDownButton, FloatingActionButton, SplitButton, Toolbar } from '@progress/kendo-vue-buttons';

    // CommonJS format
    const { Button, ButtonGroup, Chip, ChipList, DropDownButton, FloatingActionButton, SplitButton, Toolbar } = require('@progress/kendo-vue-buttons');

    3. 您需要安装一个Kendo UI for Vue主题来为您的组件设置样式。

    4. 按照步骤激活您的产品授权许可,如果您的应用程序已包含许可证密钥,则可以跳过此步骤。

    依赖项

    Buttons package要求您在应用程序中安装以下对等依赖项:

    • vue 2.6.11 or 3.0.0
    • @progress/kendo-licensing

    Kendo UI for Vue | 下载试用

    Kendo UI致力于新的开发,来满足不断变化的需求。Kendo UI for Vue使用旨在提高性能和丰富用户体验的Vue组件,帮助开发人员构建下一代应用程序。它是为Vue技术框架提供可用的Kendo UI组件,以便更快地构建更好的Vue应用程序。


    Telerik_KendoUI产品技术交流群:726377843    欢迎一起进群讨论

    了解最新Kendo UI最新资讯,请关注Telerik中文网!

  • 相关阅读:
    javaSE复习
    Tensorflow-GPU工具包了解和详细安装方法
    2.如何使用Python官方文档
    【微信小程序】使用npm包
    Linux文件权限
    【计算机视觉 | 目标检测】目标检测常用数据集及其介绍(十六)
    软件开发进度中,如何进行高风险预警管理?
    K8S(十):k8s配置中的port、targetPort、nodePort和containerPort区别
    【测试沉思录】17. 性能测试中的系统资源分析之四:网络
    图像生成2
  • 原文地址:https://blog.csdn.net/AABBbaby/article/details/125885527