vue组件转换成dom元素_一个Vue.js 2组件来克隆DOM元素

本文介绍了vue-cloneya,一个Vue.js 2组件,用于克隆DOM元素。内容包括安装、导入、使用示例、组件API,如最小和最大克隆数的属性设置,以及相关的Vue指令。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

vue组件转换成dom元素

维克隆尼 (vue-cloneya)

A vue component to clone DOM elements.

Vue组件,用于克隆DOM元素。

安装 (Install)

yarn add vue-cloneya
# or
npm i vue-cloneya

进口 (Import)

import Vue      from 'vue'
import VueCloneya from 'vue-cloneya'

Vue.use(VueCloneya)

(Example)

<vue-cloneya :maximum="5" :value="exampleData">
  <div class="input-group">
      <!-- Add the "v-cloneya-input" directive to elements you wish to set v-bind:value -->
      <!-- Only input, select, radio, checkbox etc. -->
      <input type="text" name="example[]" class="form-control" placeholder="Example" v-cloneya-input>
      <span class="input-group-btn">
        <!-- Add the "v-cloneya-add" directive to elements you wish to add the click listener
        that will clone the root element -->
        <button type="button" class="btn btn-success" tabindex="-1" v-cloneya-add>
            <i class="fa fa-plus"></i>
        </button>
        <!-- Add the "v-cloneya-remove" directive to elements you wish to add the click listener
        that will remove the element -->
        <button type="button" class="btn btn-danger" tabindex="-1"  v-cloneya-remove>
          <i class="fa fa-minus"></i>
        </button>
      </span>
  </div>
</vue-cloneya>

API (API)

道具 (Props)

最低 (minimum)
  • Type: number

    类型number

  • Default: 1

    默认值1

The minimum number of clones allowed.

允许的最小克隆数。

最大值 (maximum)
  • Type: number

    类型number

  • Default: 1

    默认值1

The maximum number of clones allowed.

允许的最大克隆数。

(value)
  • Type: array

    类型array

  • Default: null

    默认值null

The values for the v-cloneya-input.

v-cloneya-input的值。

大事记 (Events)

When minimum limit is reached:

达到最小限制时:

  • minimum:cloneya

    minimum:cloneya

When maximum limit is reached:

达到最大限制时:

  • maximum:cloneya

    maximum:cloneya

指令 (Directives)

cloneyaInput (cloneyaInput)

v-cloneya-input

v克隆人输入

cloneya添加 (cloneyaAdd)

v-cloneya-add

v-cloneya-add

cloneya删除 (cloneyaRemove)

v-cloneya-remove

v-克隆人删除

发展历程 (Development)

# for dev
yarn dev
#or 
npm run dev

# build with parcel-bundler
yarn build
#or
npm run build

翻译自: https://vuejsexamples.com/a-vue-js-2-component-to-clone-dom-elements/

vue组件转换成dom元素

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值