当前位置: 首页 > wzjs >正文

湖州企业网站开发公司php网站成品

湖州企业网站开发公司,php网站成品,网站 购买,龙泉市建设局门户网站1. 说明 在平时项目中,对于金额处理显示一般需要按千分符显示,通常实现会申明一个formater函数来进行转换,但是涉及的地方比较多试,使用起来比较繁琐,封装一个单独的组件比较合理 2. 实现组件代码 ElMoneyInput.vue …

1. 说明

在平时项目中,对于金额处理显示一般需要按千分符显示,通常实现会申明一个formater函数来进行转换,但是涉及的地方比较多试,使用起来比较繁琐,封装一个单独的组件比较合理

2. 实现组件代码

  1. ElMoneyInput.vue
<template><div :style="{'background-color': disabled ? 'transparent' : '#fff'}"><span class="money-input" v-if="!isInput" @click="focusHanle" :disabled="disabled" :value="viewValue">{{ viewValue }}</span><el-input ref="moneyInput" v-else v-bind="$attrs" :value="value" @input="handlerChange" @blur="handlerBlur" autofocus onkeypress="if(event.keyCode == 13) return false;"/></div>
</template>
<script>
export default {name: 'ElMoneyInput',inheritAttrs: false,model: {prop: "value",event: "input"},props: {value: {type: String,default: ""},disabled:{type:Boolean,default:false},rules: {type: Object,default: () => {}}},watch: {value(val, old) {if (val !== old) {this.init()}}},mounted() {this.init()},data() {return {isEdit: true,isInput: false,viewValue: ''};},methods: {init() {if (!this.isInput) {this.viewValue = this.formatMoney(this.value || 0)this.$emit('input', this.blurformat(this.value || 0))}},focusHanle() {if (this.disabled) returnthis.isInput = !this.isInputthis.$emit('input', this.blurformat(this.value || 0))this.$nextTick(() => {this.$refs.moneyInput.focus()})},formatMoney(cellValue, num = 2) {if (isNaN(cellValue)) {return ""}if (cellValue === 0) {return '0.00';}return this.$Utils.formatMoney(cellValue, num);},format(v) {return (`${v}`.match(/([\d\.]+)/) || "")[0];},blurformat(v) {return v ? Number.parseFloat(v).toFixed(2) : "";},handlerChange(v) {this.$emit('input', v)},handlerBlur() {this.isInput = false;this.$emit('input', this.blurformat(this.value))this.viewValue = this.formatMoney(this.value)},// handleFocus() {//   this.isInput = true;//   this.$emit('input', this.blurformat(this.value))// }}
};
</script>
<style lang="less">
.span-input{display: inline-block;width: 100%;height:28px;
}
.money-input {position: relative;font-size: 14px;display: inline-block;height: 32px;line-height: 32px;background: transparent !important;cursor: text !important;background-color: #FFF;background-image: none;border-radius: 4px;border: 1px solid #DCDFE6;-webkit-box-sizing: border-box;box-sizing: border-box;color: #606266;display: inline-block;font-size: inherit;outline: 0;padding: 0 15px;-webkit-transition: border-color .2s cubic-bezier(.645,.045,.355,1);transition: border-color .2s cubic-bezier(.645,.045,.355,1);width: 100%;.el-input__inner {background: transparent !important;cursor: text !important;background-color: #FFF;background-image: none;border-radius: 4px;border: 1px solid #DCDFE6;-webkit-box-sizing: border-box;box-sizing: border-box;color: #606266;display: inline-block;font-size: inherit;height: 40px;line-height: 40px;outline: 0;padding: 0 15px;-webkit-transition: border-color .2s cubic-bezier(.645,.045,.355,1);transition: border-color .2s cubic-bezier(.645,.045,.355,1);width: 100%;}
}
</style>

3.实现效果

在这里插入图片描述


文章转载自:

http://5sqPmEE9.ghrLx.cn
http://PiUmf33e.ghrLx.cn
http://Ia8sJTcR.ghrLx.cn
http://Wq4AJAAC.ghrLx.cn
http://scvYtvI6.ghrLx.cn
http://x3m2ju4H.ghrLx.cn
http://HoJuycUk.ghrLx.cn
http://3cJMchg7.ghrLx.cn
http://221e1gxV.ghrLx.cn
http://CFExV7Wk.ghrLx.cn
http://SSNaKY5X.ghrLx.cn
http://zluxG3Q4.ghrLx.cn
http://T6SikXNo.ghrLx.cn
http://EcU2w4RY.ghrLx.cn
http://6lHQohKb.ghrLx.cn
http://4Nl2S9PY.ghrLx.cn
http://oGlsyGgh.ghrLx.cn
http://tV8xoKs7.ghrLx.cn
http://cuuoH2ux.ghrLx.cn
http://ROhHV0Pd.ghrLx.cn
http://4aOgI8L0.ghrLx.cn
http://k0dwV1sl.ghrLx.cn
http://hLeFUlnS.ghrLx.cn
http://MifoTuCC.ghrLx.cn
http://2NCZzWc9.ghrLx.cn
http://YMR7Inkw.ghrLx.cn
http://VkRgmcOz.ghrLx.cn
http://tLbfZXxO.ghrLx.cn
http://jWTuRWN6.ghrLx.cn
http://tP7XVF68.ghrLx.cn
http://www.dtcms.com/wzjs/644917.html

相关文章:

  • 微信上浏览自己做的网站吗河南品牌网站建设
  • 上海杨浦区建设网站静态门户网站源码
  • 公司品牌flash网站在rds上安装wordpress
  • 坂田网站设计网络公司给我做网站我有没有源代码版权吗
  • 浙江省建设业协会网站有什么可以做兼职的网站
  • 临沂 网站建设南京建设局网站
  • 做网站青岛小程序模板大全
  • 昆凌做的广告买化妆品网站网站如何吸引
  • 金融行业做网站产品代理平台
  • 网站建设 主机选择网页视频怎么下载到本地视频手机
  • 随州网站设计开发制作网络架构必须满足哪些特性
  • 做外贸网站做成哪种形式好泰安网约车平台有哪些
  • 长春一大网站网站排名优化软件有哪些
  • 网页建站总结报告用jsp做的网站首页
  • 亚马逊品牌网站要怎么做合肥住房城乡建设部的网站
  • 做网站的需要什么软件Linux备份wordpress
  • 网站维护中页面代码如何改wordpress的title
  • discuz做商城网站网站建设程序有哪些方面
  • wordpress 开启多站点网站建设和编辑实训报告
  • 网站优化搜索广州装饰公司
  • 用什么网站推广兴仁企业建站公司
  • 网站结构分析怎么写网站顶部导航
  • 太仓网站制作开发新闻类网站
  • 济南做网站的公司有哪些wordpress主题购物
  • 哈尔滨网站建设方案策划电影网站建设步骤
  • 手机网站按那个尺寸做做网站用框架
  • iis 网站访问权限设置wordpress模板安装失败
  • 资源网站如何做广州 网站备案
  • 遵义网站建设oadmin北京正规网站建设经历
  • 网站建设吉金手指专业12广州shopify代建站