电脑知识|欧美黑人一区二区三区|软件|欧美黑人一级爽快片淫片高清|系统|欧美黑人狂野猛交老妇|数据库|服务器|编程开发|网络运营|知识问答|技术教程文章 - 好吧啦网

您的位置:首頁技術文章
文章詳情頁

vue+element 實現商城主題開發的示例代碼

瀏覽:106日期:2023-01-29 18:14:52

本文介紹了vue+element 實現商城主題開發的示例代碼,分享給大家,具體如下:

vue+element 實現商城主題開發的示例代碼

vue+element 實現商城主題開發的示例代碼

<template> <div> <div class='set-phone'> <el-form :model='theme' :rules='rules' ref='ruleForm' class='demo-ruleForm'> <el-form-item label='主題名稱:' prop='name'> <el-input v-model='theme.name' size='small' maxlength='18' show-word-limit></el-input> </el-form-item> <el-form-item label='頂部背景色:' prop='backgroundColor'> <el-input v-model='theme.backgroundColor' placeholder='#000000' size='small' maxlength='7' show-word-limit @change='setBgc' oninput='value=value.replace(/[^0-9abcdefABCDEF#]/g,’’)' ></el-input> </el-form-item> <el-row type='flex' justify='space-around'> <el-col :span='6'> <el-form-item prop='shopStreetImg'> <p class='cla-p'>店鋪街</p> <multiUpload @upImg='res => $set(theme,’shopStreetImg’, res)' :value='theme.shopStreetImg' :maxCount='1' ></multiUpload> </el-form-item> </el-col> <el-col :span='6'> <el-form-item prop='classifyImg'> <p class='cla-p'>分類</p> <multiUpload @upImg='res => $set(theme,’classifyImg’, res)' :value='theme.classifyImg' :maxCount='1' ></multiUpload> </el-form-item> </el-col> <el-col :span='6'> <el-form-item prop='starBagImg'> <p class='cla-p'>星級禮包</p> <multiUpload @upImg='res => $set(theme,’starBagImg’, res)' :value='theme.starBagImg' :maxCount='1' ></multiUpload> </el-form-item> </el-col> <el-col :span='6'> <el-form-item prop='signInImg'> <p class='cla-p'>簽到</p> <multiUpload @upImg='res => $set(theme,’signInImg’, res)' :value='theme.signInImg' :maxCount='1' ></multiUpload> </el-form-item> </el-col> </el-row> <el-row type='flex' justify='space-around'> <el-col :span='6'> <el-form-item prop='yuanbaoShopImg'> <p class='cla-p'>元寶商城</p> <multiUpload @upImg='res => $set(theme,’yuanbaoShopImg’, res)' :value='theme.yuanbaoShopImg' :maxCount='1' ></multiUpload> </el-form-item> </el-col> <el-col :span='6'> <el-form-item prop='luckDrawImg'> <p class='cla-p'>抽獎</p> <multiUpload @upImg='res => $set(theme,’luckDrawImg’, res)' :value='theme.luckDrawImg' :maxCount='1' ></multiUpload> </el-form-item> </el-col> <el-col :span='6'> <el-form-item prop='limitedSeckillImg'> <p class='cla-p'>限時秒殺</p> <multiUpload @upImg='res => $set(theme,’limitedSeckillImg’, res)' :value='theme.limitedSeckillImg' :maxCount='1' ></multiUpload> </el-form-item> </el-col> <el-col :span='6'> <el-form-item prop='oddsProductImg'> <p class='cla-p'>特惠商品</p> <multiUpload @upImg='res => $set(theme,’oddsProductImg’, res)' :value='theme.oddsProductImg' :maxCount='1' ></multiUpload> </el-form-item> </el-col> </el-row> <el-form-item label='導航字體顏色:' prop='navigationFontColor'> <el-input v-model='theme.navigationFontColor' size='small' maxlength='7' show-word-limit @change='setNavColor' oninput='value=value.replace(/[^0-9abcdefABCDEF#]/g,’’)' ></el-input> </el-form-item> <el-form-item label='導航背景圖片:' prop='navigationBackgroundImg'> <multiUpload @upImg='res => $set(theme,’navigationBackgroundImg’, res)' :value='theme.navigationBackgroundImg' :maxCount='1' ></multiUpload> </el-form-item> <el-row type='flex' justify='space-around'> <el-col :span='4'> <el-form-item prop='homePageIconUnchecked'> <p class='cla-p'>首頁未選中圖標</p> <multiUpload @upImg='res => $set(theme,’homePageIconUnchecked’, res)' :value='theme.homePageIconUnchecked' :maxCount='1' ></multiUpload> </el-form-item> </el-col> <el-col :span='4'> <el-form-item prop='recommendIconUnchecked'> <p class='cla-p'>推薦未選中圖標</p> <multiUpload @upImg='res => $set(theme,’recommendIconUnchecked’, res)' :value='theme.recommendIconUnchecked' :maxCount='1' ></multiUpload> </el-form-item> </el-col> <el-col :span='4'> <el-form-item prop='searchIconUnchecked'> <p class='cla-p'>搜索未選中圖標</p> <multiUpload @upImg='res => $set(theme,’searchIconUnchecked’, res)' :value='theme.searchIconUnchecked' :maxCount='1' ></multiUpload> </el-form-item> </el-col> <el-col :span='4'> <el-form-item prop='chatIconUnchecked'> <p class='cla-p'>聊天未選中圖標</p> <multiUpload @upImg='res => $set(theme,’chatIconUnchecked’, res)' :value='theme.chatIconUnchecked' :maxCount='1' ></multiUpload> </el-form-item> </el-col> <el-col :span='4'> <el-form-item prop='personalCenterIconUnchecked'> <p class='cla-p'>個人中心未選中圖標</p> <multiUpload @upImg='res => $set(theme,’personalCenterIconUnchecked’, res)' :value='theme.personalCenterIconUnchecked' :maxCount='1' ></multiUpload> </el-form-item> </el-col> </el-row> <el-row type='flex' justify='space-around'> <el-col :span='4'> <el-form-item prop='homePageIconChecked'> <p class='cla-p'>首頁選中圖標</p> <multiUpload @upImg='res => $set(theme,’homePageIconChecked’, res)' :value='theme.homePageIconChecked' :maxCount='1' ></multiUpload> </el-form-item> </el-col> <el-col :span='4'> <el-form-item prop='recommendIconChecked'> <p class='cla-p'>推薦選中圖標</p> <multiUpload @upImg='res => $set(theme,’recommendIconChecked’, res)' :value='theme.recommendIconChecked' :maxCount='1' ></multiUpload> </el-form-item> </el-col> <el-col :span='4'> <el-form-item prop='searchIconChecked'> <p class='cla-p'>搜索選中圖標</p> <multiUpload @upImg='res => $set(theme,’searchIconChecked’, res)' :value='theme.searchIconChecked' :maxCount='1' ></multiUpload> </el-form-item> </el-col> <el-col :span='4'> <el-form-item prop='chatIconChecked'> <p class='cla-p'>聊天選中圖標</p> <multiUpload @upImg='res => $set(theme,’chatIconChecked’, res)' :value='theme.chatIconChecked' :maxCount='1' ></multiUpload> </el-form-item> </el-col> <el-col :span='4'> <el-form-item prop='personalCenterIconChecked'> <p class='cla-p'>個人中心選中圖標</p> <multiUpload @upImg='res => $set(theme,’personalCenterIconChecked’, res)' :value='theme.personalCenterIconChecked' :maxCount='1' ></multiUpload> </el-form-item> </el-col> </el-row> <el-form-item label='底部選中字體顏色:' prop='bottomSelectFontColor'> <el-input v-model='theme.bottomSelectFontColor' size='small' maxlength='7' show-word-limit placeholder='#000000' @change='setBbgc' oninput='value=value.replace(/[^0-9abcdefABCDEF#]/g,’’)' ></el-input> </el-form-item> <el-form-item> <el-button type='primary' @click='submitForm(’ruleForm’)'>保存</el-button> </el-form-item> </el-form> </div> <!-- 顯示樣式 --> <div :style='’background: ’ + theme.backgroundColor'> <img src='http://www.hdgsjgj.cn/bcjs/@/assets/images/app_header.png' alt /> <el-menu :default-active='activeIndex' mode='horizontal' background-color='transparent' text-color='#fafafa' active-text-color='white' > <el-menu-item index='1'>熱門</el-menu-item> <el-menu-item index='2'>女裝</el-menu-item> <el-menu-item index='3'>百貨</el-menu-item> <el-menu-item index='4'>鞋包</el-menu-item> <el-menu-item index='5'>食品</el-menu-item> <el-menu-item index='6'>母嬰</el-menu-item> </el-menu> <el-carousel :interval='5000'> <el-carousel-item v-for='item in banner' :key='item.id'> <el-image fit='cover' :src='http://www.hdgsjgj.cn/bcjs/item.pic' alt /> </el-carousel-item> </el-carousel> <div :style='theme.navigationBackgroundImg && ’background-image: url(’ + theme.navigationBackgroundImg + ’)’'> <div class='nav-item'> <img :src='http://www.hdgsjgj.cn/bcjs/theme.shopStreetImg' alt /> <p :style='’color: ’ + theme.navigationFontColor'>店鋪街</p> </div> <div class='nav-item'> <img :src='http://www.hdgsjgj.cn/bcjs/theme.classifyImg' alt /> <p :style='’color: ’ + theme.navigationFontColor'>分類</p> </div> <div class='nav-item'> <img :src='http://www.hdgsjgj.cn/bcjs/theme.starBagImg' alt /> <p :style='’color: ’ + theme.navigationFontColor'>星級禮包</p> </div> <div class='nav-item'> <img :src='http://www.hdgsjgj.cn/bcjs/theme.signInImg' alt /> <p :style='’color: ’ + theme.navigationFontColor'>簽到</p> </div> <div class='nav-item'> <img :src='http://www.hdgsjgj.cn/bcjs/theme.yuanbaoShopImg' alt /> <p :style='’color: ’ + theme.navigationFontColor'>元寶商城</p> </div> <div class='nav-item'> <img :src='http://www.hdgsjgj.cn/bcjs/theme.luckDrawImg' alt /> <p :style='’color: ’ + theme.navigationFontColor'>抽獎</p> </div> <div class='nav-item'> <img :src='http://www.hdgsjgj.cn/bcjs/theme.limitedSeckillImg' alt /> <p :style='’color: ’ + theme.navigationFontColor'>限時秒殺</p> </div> <div class='nav-item'> <img :src='http://www.hdgsjgj.cn/bcjs/theme.oddsProductImg' alt /> <p :style='’color: ’ + theme.navigationFontColor'>特惠商品</p> </div> </div> <img src='http://www.hdgsjgj.cn/bcjs/@/assets/images/goods.png' alt /> <ul class='footer'> <li @click='bottomIndex = 1'> <img :src='http://www.hdgsjgj.cn/bcjs/bottomIndex === 1 ? theme.homePageIconChecked : theme.homePageIconUnchecked' alt /> <p : >首頁</p> </li> <li @click='bottomIndex = 2'> <img :src='http://www.hdgsjgj.cn/bcjs/bottomIndex === 2 ? theme.recommendIconChecked : theme.recommendIconUnchecked' alt /> <p : >推薦</p> </li> <li @click='bottomIndex = 3'> <img :src='http://www.hdgsjgj.cn/bcjs/bottomIndex === 3 ? theme.searchIconChecked : theme.searchIconUnchecked' alt /> <p : >搜索</p> </li> <li @click='bottomIndex = 4'> <img :src='http://www.hdgsjgj.cn/bcjs/bottomIndex === 4 ? theme.chatIconChecked : theme.chatIconUnchecked' alt /> <p : >聊天</p> </li> <li @click='bottomIndex = 5'> <img :src='http://www.hdgsjgj.cn/bcjs/bottomIndex === 5 ? theme.personalCenterIconChecked : theme.personalCenterIconUnchecked' alt /> <p : >個人中心</p> </li> </ul> </div> </div></template>

<script>import { createThemeColor, updateThemeColor, getThemeColor } from '@/api/scs/themeColor';import { getRotationChart } from '@/api/sms/homeAdvertise';import MultiUpload from '@/components/Upload/multiUpload';export default { name: 'EditColor', props: { isEdit: { type: Boolean, default: false } }, components: { MultiUpload }, data() { return { theme: { backgroundColor: '#000000', bottomSelectFontColor: '#ffffff', navigationFontColor: ’#000000’ }, activeIndex: '1', activeIndex2: '1', bottomIndex: 1, banner: [], rules: { name: [ { required: true, message: '請輸入主題名稱', trigger: 'blur' }, { min: 2, max: 18, message: '值為2 - 18位數', trigger: 'blur' } ], backgroundColor: [ { required: true, message: '請輸入顏色值', trigger: 'blur' }, { min: 7, max: 7, message: '值為7位數', trigger: 'blur' } ], bottomSelectFontColor: [ { required: true, message: '請輸入顏色值', trigger: 'blur' }, { min: 7, max: 7, message: '值為7位數', trigger: 'blur' } ], navigationFontColor: [ { required: true, message: '請輸入顏色值', trigger: 'blur' }, { min: 7, max: 7, message: '值為7位數', trigger: 'blur' } ], shopStreetImg: [ { required: true, message: '請上傳圖片', trigger: 'blur' } ], classifyImg: [ { required: true, message: '請上傳圖片', trigger: 'blur' } ], starBagImg: [ { required: true, message: '請上傳圖片', trigger: 'blur' } ], signInImg: [{ required: true, message: '請上傳圖片', trigger: 'blur' }], yuanbaoShopImg: [ { required: true, message: '請上傳圖片', trigger: 'blur' } ], luckDrawImg: [ { required: true, message: '請上傳圖片', trigger: 'blur' } ], limitedSeckillImg: [ { required: true, message: '請上傳圖片', trigger: 'blur' } ], oddsProductImg: [ { required: true, message: '請上傳圖片', trigger: 'blur' } ], navigationBackgroundImg: [ { required: true, message: '請上傳圖片', trigger: 'blur' } ], homePageIconUnchecked: [ { required: true, message: '請上傳圖片', trigger: 'blur' } ], recommendIconUnchecked: [ { required: true, message: '請上傳圖片', trigger: 'blur' } ], searchIconUnchecked: [ { required: true, message: '請上傳圖片', trigger: 'blur' } ], chatIconUnchecked: [ { required: true, message: '請上傳圖片', trigger: 'blur' } ], personalCenterIconUnchecked: [ { required: true, message: '請上傳圖片', trigger: 'blur' } ], homePageIconChecked: [ { required: true, message: '請上傳圖片', trigger: 'blur' } ], recommendIconChecked: [ { required: true, message: '請上傳圖片', trigger: 'blur' } ], searchIconChecked: [ { required: true, message: '請上傳圖片', trigger: 'blur' } ], chatIconChecked: [ { required: true, message: '請上傳圖片', trigger: 'blur' } ], personalCenterIconChecked: [ { required: true, message: '請上傳圖片', trigger: 'blur' } ] } }; }, created() { this.getBanner(); if (this.isEdit) { getThemeColor(this.$route.query.id).then(response => { this.theme = response.data; }); } }, methods: { getBanner() { getRotationChart({ pageNum: 1, pageSize: 50 }).then(res => { this.banner = res.data.records; }); }, setBgc(res) { if (res.split('')[0] !== '#' || res.match(/#/g).length > 1) { this.$message.error('顏色格式錯誤,請從新填寫。'); this.$set(this.theme, 'backgroundColor', '#000000'); return false; } this.$set(this.theme, 'backgroundColor', res); }, setBbgc(res) { if (res.split('')[0] !== '#' || res.match(/#/g).length > 1) { this.$message.error('顏色格式錯誤,請從新填寫。'); this.$set(this.theme, 'bottomSelectFontColor', '#ffffff'); return false; } this.$set(this.theme, 'bottomSelectFontColor', res); }, setNavColor(res) { if (res.split('')[0] !== '#' || res.match(/#/g).length > 1) { this.$message.error('顏色格式錯誤,請從新填寫。'); this.$set(this.theme, 'navigationFontColor', '#000000'); return false; } this.$set(this.theme, 'navigationFontColor', res); }, selectProductInfo(res) { this.product = Object.assign(res, this.product); }, submitForm(formName) { this.$refs[formName].validate(valid => { if (valid) { this.$confirm('是否提交數據', '提示', { confirmButtonText: '確定', cancelButtonText: '取消', type: 'warning' }).then(() => { if (this.isEdit) { updateThemeColor(this.$route.query.id, this.theme).then( response => { if (response.code == 200) { this.$message({ message: '修改成功', type: 'success', duration: 1000 }); this.$router.back(); } else { this.$message({ message: response.msg, type: 'error', duration: 1000 }); } } ); } else { createThemeColor(this.theme).then(response => { if (response.code == 200) { this.$message({ message: '提交成功', type: 'success', duration: 1000 }); this.$router.back(); } else { this.$message({ message: response.msg, type: 'error', duration: 1000 }); } }); } }); } else { this.$message({ message: '驗證失敗', type: 'error', duration: 1000 }); return false; } }); } }};</script>

<style lang='scss' scoped>.set-phone { width: calc(100% - 400px); padding: 5%; .el-form-item { margin-bottom: 18px; } .cla-p { padding: 0; margin: 0; color: #666; line-height: 40px; }}.app-phone { position: fixed; top: 70px; right: 5%; width: 350px; box-shadow: 0 0 10px rgba(50, 50, 50, 0.2); perspective:150; transition: all .2s linear; overflow: hidden; &:hover { transform: translate3d(0,0,4px); box-shadow: 0 4px 8px #e1e1e1; box-shadow: 0 0 20px rgba(50, 50, 50, 0.3); } .header-img { display: block; width: 96%; margin: 4px 2%; } .el-menu-demo { display: flex; justify-content: space-around; margin: 2px 4% 0 4%; border: none; } .el-menu--horizontal > .el-menu-item { height: auto; line-height: normal; padding: 4px 12px; margin: 0; } .banner-img { display: block; width: 100%; height: 100%; } .nav { display: flex; flex-wrap: wrap; justify-content: space-around; padding: 10px 0; background: white; background-size: cover; background-repeat:no-repeat; .nav-item { width: 50px; height: 80px; margin: 0 15px; text-align: center; .item-img { width: 50px; height: 50px; } .item-name { padding: 0; margin: 2px 0; font-size: 12px; } } } .goods { width: 100%; } .footer { display: flex; flex-wrap: wrap; justify-content: space-around; width: 100%; height: 50px; padding: 0; margin: 0; .item { list-style: none; width: 50px; text-align: center; .item-img { width: 30px; height: 30px; } .item-name { padding: 0; margin: 0; font-size: 10px; color: white; } } }}</style>

到此這篇關于vue+element 實現商城主題開發的示例代碼的文章就介紹到這了,更多相關vue element 商城主題開發內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!

標簽: Vue
相關文章:
主站蜘蛛池模板: 缠绕机|缠绕膜包装机|缠绕包装机-上海晏陵智能设备有限公司 | 江西高职单独招生-江西单招考试-江西高职单招网 | 高压无油空压机_无油水润滑空压机_水润滑无油螺杆空压机_无油空压机厂家-科普柯超滤(广东)节能科技有限公司 | 口臭的治疗方法,口臭怎么办,怎么除口臭,口臭的原因-口臭治疗网 | 氮化镓芯片-碳化硅二极管 - 华燊泰半导体 | 生产加气砖设备厂家很多,杜甫机械加气砖设备价格公道 | nalgene洗瓶,nalgene量筒,nalgene窄口瓶,nalgene放水口大瓶,浙江省nalgene代理-杭州雷琪实验器材有限公司 | 同学聚会纪念册制作_毕业相册制作-成都顺时针宣传画册设计公司 | 智能型高压核相仪-自动开口闪点测试仪-QJ41A电雷管测试仪|上海妙定 | 手术室净化厂家_成都实验室装修公司_无尘车间施工单位_洁净室工程建设团队-四川华锐16年行业经验 | 国产频谱分析仪-国产网络分析仪-上海坚融实业有限公司 | China plate rolling machine manufacturer,cone rolling machine-Saint Fighter | 吸污车_吸粪车_抽粪车_电动三轮吸粪车_真空吸污车_高压清洗吸污车-远大汽车制造有限公司 | 新中天检测有限公司青岛分公司-山东|菏泽|济南|潍坊|泰安防雷检测验收 | 合肥风管加工厂-安徽螺旋/不锈钢风管-通风管道加工厂家-安徽风之范 | 锻造液压机,粉末冶金,拉伸,坩埚成型液压机定制生产厂家-山东威力重工官方网站 | 液晶拼接屏厂家_拼接屏品牌_拼接屏价格_监控大屏—北京维康 | 波纹补偿器_不锈钢波纹补偿器_巩义市润达管道设备制造有限公司 | 青岛空压机,青岛空压机维修/保养,青岛空压机销售/出租公司,青岛空压机厂家电话 | 根系分析仪,大米外观品质检测仪,考种仪,藻类鉴定计数仪,叶面积仪,菌落计数仪,抑菌圈测量仪,抗生素效价测定仪,植物表型仪,冠层分析仪-杭州万深检测仪器网 | Q361F全焊接球阀,200X减压稳压阀,ZJHP气动单座调节阀-上海戎钛 | 银川美容培训-美睫美甲培训-彩妆纹绣培训-新娘化妆-学化妆-宁夏倍莱妮职业技能培训学校有限公司 临时厕所租赁_玻璃钢厕所租赁_蹲式|坐式厕所出租-北京慧海通 | 德国BOSCH电磁阀-德国HERION电磁阀-JOUCOMATIC电磁阀|乾拓百科 | NMRV减速机|铝合金减速机|蜗轮蜗杆减速机|NMRV减速机厂家-东莞市台机减速机有限公司 | 巨野电机维修-水泵维修-巨野县飞宇机电维修有限公司 | 上海小程序开发-小程序制作-上海小程序定制开发公司-微信商城小程序-上海咏熠 | 南京泽朗生物科技有限公司 | 高中学习网-高考生信息学习必备平台 | 爆破器材运输车|烟花爆竹运输车|1-9类危险品厢式运输车|湖北江南专用特种汽车有限公司 | 涂层测厚仪_光泽度仪_uv能量计_紫外辐照计_太阳膜测试仪_透光率仪-林上科技 | 磁力去毛刺机_去毛刺磁力抛光机_磁力光饰机_磁力滚抛机_精密金属零件去毛刺机厂家-冠古科技 | 大型果蔬切片机-水果冬瓜削皮机-洗菜机切菜机-肇庆市凤翔餐饮设备有限公司 | 除尘器布袋骨架,除尘器滤袋,除尘器骨架,电磁脉冲阀膜片,卸灰阀,螺旋输送机-泊头市天润环保机械设备有限公司 | 1000帧高速摄像机|工业高速相机厂家|科天健光电技术 | 土壤养分检测仪_肥料养分检测仪_土壤水分检测仪-山东莱恩德仪器 大型多片锯,圆木多片锯,方木多片锯,板材多片锯-祥富机械有限公司 | 冷藏车厂家|冷藏车价格|小型冷藏车|散装饲料车厂家|程力专用汽车股份有限公司销售十二分公司 | 光泽度计_测量显微镜_苏州压力仪_苏州扭力板手维修-苏州日升精密仪器有限公司 | 地埋式垃圾站厂家【佳星环保】小区压缩垃圾中转站转运站 | 电动葫芦-河北悍象起重机械有限公司 | 洁净棚-洁净工作棚-无菌室-净化工程公司_北京卫护科技有限公司 | 闪蒸干燥机-喷雾干燥机-带式干燥机-桨叶干燥机-[常州佳一干燥设备] |