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

小企业公司网站怎么建wordpress展示

小企业公司网站怎么建,wordpress展示,网站宣传和推广的方法有哪些,电商网站数据中心建设方案前言 近期产品需求&#xff1a;Vue2移动端项目需要在switch开关内显示文字&#xff0c;看Vantui没有对应功能&#xff0c;因此自己手撸写了这个组件。 一、最终效果 二、参数配置 1、代码示例&#xff1a; <t-switch v-model"check"/>2、配置参数&#xff08;…

前言

近期产品需求:Vue2移动端项目需要在switch开关内显示文字,看Vantui没有对应功能,因此自己手撸写了这个组件。

一、最终效果

在这里插入图片描述

二、参数配置

1、代码示例:

 <t-switch v-model="check"/>

2、配置参数(t-switch Attributes)

参数说明类型默认值
v-model绑定值boolean / string / number
disabled是否禁用booleanfalse
widthswitch 的宽度(像素)number55
active-icon-classswitch 打开时所显示图标的类名,设置此项会忽略 active-textstring
inactive-icon-classswitch 关闭时所显示图标的类名,设置此项会忽略 inactive-textstring
active-textswitch 打开时的文字描述string
inactive-textswitch 关闭时的文字描述string
active-valueswitch 打开时的值boolean / string / numbertrue
inactive-valueswitch 关闭时的值boolean / string / numberfalse
active-colorswitch 打开时的背景色string#2b73bb
inactive-colorswitch 关闭时的背景色string#ccc
nameswitch 对应的 name 属性string

3、events 事件

事件名称说明回调参数
changeswitch 状态发生变化时的回调函数新状态的值

三、源码

<template><divclass="t-switch":class="{ 'is-disabled': switchDisabled, 'is-checked': checked }"role="switch":aria-checked="checked":aria-disabled="switchDisabled"@click.prevent="switchValue"><inputclass="t-switch__input"type="checkbox"@change="handleChange"ref="input":id="id":name="name":true-value="activeValue":false-value="inactiveValue":disabled="switchDisabled"@keydown.enter="switchValue"/><span:class="['t-switch__label', 't-switch__label--left', !checked ? 'is-active' : '']"v-if="inactiveIconClass || inactiveText"><i :class="[inactiveIconClass]" v-if="inactiveIconClass"></i><span v-if="!inactiveIconClass && inactiveText" :aria-hidden="checked">{{ inactiveText }}</span></span><span class="t-switch__core" ref="core" :style="{ 'width': coreWidth + 'px' }"></span><span:class="['t-switch__label', 't-switch__label--right', checked ? 'is-active' : '']"v-if="activeIconClass || activeText"><i :class="[activeIconClass]" v-if="activeIconClass"></i><span v-if="!activeIconClass && activeText" :aria-hidden="!checked">{{ activeText }}</span></span></div>
</template>
<script>export default {name: 'TSwitch',props: {value: {type: [Boolean, String, Number],default: false},disabled: {type: Boolean,default: false},width: {type: Number,default: 55},activeIconClass: {type: String,default: ''},inactiveIconClass: {type: String,default: ''},activeText: String,inactiveText: String,activeColor: {type: String,default: '#2b73bb'},inactiveColor: {type: String,default: '#ccc'},activeValue: {type: [Boolean, String, Number],default: true},inactiveValue: {type: [Boolean, String, Number],default: false},name: {type: String,default: ''},id: String},data() {return {coreWidth: this.width};},created() {if (!~[this.activeValue, this.inactiveValue].indexOf(this.value)) {this.$emit('input', this.inactiveValue);}},computed: {checked() {return this.value === this.activeValue;},switchDisabled() {return this.disabled}},watch: {checked() {this.$refs.input.checked = this.checked;if (this.activeColor || this.inactiveColor) {this.setBackgroundColor();}}},methods: {handleChange(event) {const val = this.checked ? this.inactiveValue : this.activeValue;this.$emit('input', val);this.$emit('change', val);this.$nextTick(() => {if (this.$refs.input) {this.$refs.input.checked = this.checked;}});},setBackgroundColor() {let newColor = this.checked ? this.activeColor : this.inactiveColor;this.$refs.core.style.borderColor = newColor;this.$refs.core.style.backgroundColor = newColor;},switchValue() {!this.switchDisabled && this.handleChange();}},mounted() {/* istanbul ignore if */this.coreWidth = this.width || 40;if (this.activeColor || this.inactiveColor) {this.setBackgroundColor();}this.$refs.input.checked = this.checked;this.$refs['input'].focus()}
};
</script>
<style lang="scss" scoped>
.t-switch {display: -webkit-inline-box;display: -ms-inline-flexbox;display: inline-flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;position: relative;font-size: 14px;height: 22px;vertical-align: middle;&.is-disabled {opacity: 0.6;.t-switch__core,.t-switch__label {cursor: not-allowed;}}&.is-checked {.t-switch__core {&::after {left: 100%;margin-left: -19px;}}}.label-fade-enter,.label-fade-leave-active {opacity: 0;}.t-switch__label {margin: 0;position: absolute;display: none;color: #fff;&.is-active {display: inline-block;color: #fff;}* {line-height: 1;font-size: 14px;display: inline-block;}}.t-switch__label--left {right: 5px;z-index: 9;}.t-switch__label--right {left: 5px;z-index: 9;}.t-switch__input {position: absolute;width: 0;height: 0;opacity: 0;margin: 0;}.t-switch__core {margin: 0;position: relative;width: 40px;height: 22px;border: 1px solid #dcdfe6;outline: 0;border-radius: 10px;-webkit-box-sizing: border-box;box-sizing: border-box;background: #dcdfe6;-webkit-transition: border-color 0.3s, background-color 0.3s;transition: border-color 0.3s, background-color 0.3s;&:after {content: "";position: absolute;top: 1px;left: 1px;border-radius: 100%;-webkit-transition: all 0.3s;transition: all 0.3s;width: 18px;height: 18px;background-color: #fff;}}
}
</style>

相关文章

基于ElementUi再次封装基础组件文档


基于ant-design-vue再次封装基础组件文档


vue3+ts基于Element-plus再次封装基础组件文档

http://www.yayakq.cn/news/336915/

相关文章:

  • 旅游做攻略用什么网站好网站建设对企业品牌价值提升的影响
  • 怎么做质量高的网站杭州seo网站哪家好
  • 网站建设平台一般多少钱王烨峰
  • 大型网站的标准防窜货管理系统开发
  • 建站 手机网站米课的wordpress
  • 一个服务器上建立多个网站吗app怎样制作软件
  • 建网站优化湖南省网站设计公司
  • 建设银行的财务网站一个网站可以同时几个主域名吗
  • 申请域名后怎样建设网站中国十大门户网站排行
  • 网站空间流量四川住房和城乡建设局网站首页
  • wordpress附件图片天津如何做seo优化服务
  • 旅游电子商务网站推广营销大的公司
  • 网站维护方法环球贸易网官网
  • 墙纸 html 网站模板网站要挂工商标识怎么做
  • 网站建设简介怎么样北京漫步云端网站建设
  • 平面设计实例网站广州推广工具
  • 西宁电商网站制作公司西安网络营销公司排名
  • 哪里有做网站的平台企业架构设计
  • 网站建设top图网站开发技术指标
  • 安徽鑫华建设有限公司网站wordpress 做下载网
  • 大望路网站建设公司免费建网站在那里好
  • 阿里云服务器搭建网站网站建设文化服务
  • 网站策划和网站制作门户网站改造方案
  • 营销策划公司是干什么的广告优化师工资一般多少
  • 石材公司网站珠海网站制作网络公司
  • 盐城有没有做公司网站WordPress完整安裝包
  • 新公司做网站多少钱商家在携程旅游网站怎样做宣传
  • 宽带专家网站做电子商务网站的公司
  • 网站开发需要英语西宁设计网站建设
  • 网站引流.宝安中心医院口腔科电话