lvcurrencyinput
v2.0.3
Published
vue2国际货币
Readme
安装
npm i lvcurrencyinput
import lvcurrencyinput from 'lvcurrencyinput'
Vue.use(lvcurrencyinput)说明
目前有人民币以及美元两种货币 人民币类型为1,美元类型为2
使用
<el-input ref="xxx" v-model="对象.对象属性" v-currency="$CurrencyInput.returnConfig(币种类型)"></el-input>- 清除数据参数为元素的ref对象
this.$nextTick(()=>{
this.$CurrencyInput.clearableValue(ref对象)
})- 更新数据
this.$nextTick(()=>{
this.$CurrencyInput.updateValue(ref对象,更新的数值)
})- 数值转换
例:String为 $1,000.00 转换后为 1000
对象.对象属性=this.$CurrencyInput.formattedValue(String,币种类型);测试地址
- vue2示例: https://codesandbox.io/s/rv95r?file=/src/App.vue:214-222
- vue3示例: https://codesandbox.io/s/using-vue-currency-input-with-element-plus-8b6rc?from-embed=&file=/src/components/ElCurrencyInput.vue:311-327
