当前位置: 网站首页>小程序开发>小程序制作

乐山网站制作【乐山网站优化】乐山建网站、乐山微信公众号运营、乐山网页设计、乐山微信小程序商城

发表日期: 2021-06-03 14:06:25 浏览次数:153

乐山网站制作【乐山网站优化】乐山建网站、乐山微信公众号运营、乐山网页设计、乐山微信小程序商城


网站建设.jpg


乐山,四川省辖地级市,古称嘉州,有“海棠香国”的美誉。位于四川省中部,四川盆地的西南部,地势西南高,东北低,属中亚热带气候带。乐山是四川省重要工业城市、成都经济区南部区域中心城市、重要枢纽城市、成渝城市群重要交通节点和港口城市。成昆铁路、成贵高铁贯穿全境。 [1]  乐山三江汇合。大渡河,青衣江在乐山大佛脚下汇入岷江。 [2] 

乐山是国家历史文化名城,国家首批对外开放城市、全国绿化模范城市、中国优秀旅游城市、国家园林城市、全国卫生城市。乐山有世界级遗产三处—世界自然与文化遗产峨眉山和乐山大佛、世界灌溉工程遗产东风堰,国家4A级景区以上景区15处,国家A级景区35处。 [3] 

截至2018年底,乐山市辖4区6县,代管1个县级市,总面积12720.03平方公里。2018年底户籍人口350.68万人,常住人口326.7万。 [3]  2020年乐山市地区生产总值2003.43亿元。 [50] 

2019年7月,被评为国家知识产权试点城市。 [5]  2020年10月20日,入选全国双拥模范城(县)名单。 [6] 



概述

vue实现单选多选

1.单选按钮

vue实现单选和多选功能

代码如下
css样式:

<style>ul,li {    list-style-type: none;}{    margin: 0;    padding: 0;}.border-1px {    position: relative;}.border-1px:after {    display: block;    position: absolute;    left: 0;    bottom: 0;    width: 100%;    border-top: 1px solid rgba(7, 17, 27, .1);    content: ' ';}@media (-webkit-min-device-pixel-ratio: 1.5),    (min-device-pixel-ratio: 1.5) {        .border-1px::after {            -webkit-transform: scaleY(0.7);            transform: scaleY(0.7);        }    }@media (-webkit-min-device-pixel-ratio: 2),    (min-device-pixel-ratio: 2) {        .border-1px ::after {            -webkit-transform: scaleY(0.5);            transform: scaleY(0.5);        }    }#example {    margin: 20px;}h3 {    font-size: 26px;    margin-left: 20px;    height: 60px;}.self-radio {    display: none;}.self-radio+label {    -webkit-appearance: none;    background-color: #fff;    border: 1px solid #aaa;    border-radius: 50px;    display: inline-block;    position: relative;    width: 30px;    height: 30px;    box-sizing: border-box;}.self-radio:checked+label {    border: 1px #47d9bf solid;}.self-radio:checked+label:after {    position: absolute;    top: 9px;    left: 9px;    content: ' ';    width: 10px;    height: 10px;    border-radius: 50px;    background: #47d9bf;    box-shadow: 0px 0px 5px 0px #47d9bf;}.check-area {    display: inline-block;    width: 400px;    padding: 12px 20px;    border: 1px solid #aaa;    border-top-left-radius: 4px;    border-top-right-radius: 4px;}li {    height: 60px;}li .self-radio+label {    vertical-align: middle;}li span {    margin-left: 20px;    display: inline-block;    line-height: 60px;    font-size: 22px;}p {    height: 60px;    line-height: 60px;    margin-left: 20px;}p span {    color: #f00;}.btn {    margin: 20px auto;    width: 100%;    text-align: center;}.btn button {    width: 120px;    height: 40px;    line-height: 30px;    font-size: 16px;    color: #fff;    background: #47d9bf;    border: 1px #23d5b6 solid;    border-radius: 6px;    text-align: center;    outline: none;}.btn button:hover {    background: #23d5b6;}</style>

html代码:

<div id="example">    <h3>单选按钮</h3>    <div class="check-area" v-show="items.length!=0">        <ul>            <li class="border-1px" v-for="(item,index) in items">                 <input class="self-radio" type="radio"                        :id="'radio-'+item.id"                        :data-id="'food-'+item.id" name="radio"                        :checked="index==0"                        :value="item.value" v-model="checkValue">                 <label :for="'radio-'+item.id" @click="setCheckValue(item)"></label>                 <span>{{item.value}}</span>             </li>        </ul>        <p>您选择了:<span>{{checkValue}}</span></p>        <div class="btn"> <button @click="showCheck(checkId)">按钮</button> <span>{{checkId}}</span> </div>    </div></div>

js代码:

<script>    var itemData = [{        id: '20170811001',        value: '香蕉'    }, {        id: '20170811002',        value: '苹果'    }, {        id: '20170811003',        value: '梨子'    }, {        id: '20170811004',        value: '葡萄'    }] //itemData = [];     var vm = new Vue({        el: '#example',        data: {            items: '',            checkValue: '',            checkId: ''        },        methods: {            init: function() {},            initData: function() {                var self = this;                self.items = itemData;                if(itemData.length != 0) {                    self.checkValue = self.items[0].value;                    self.checkId = 'food-' + self.items[0].id                }            },            setCheckValue: function(item) {                this.checkId = 'food-' + item.id;            },            showCheck: function() {                console.log(this.checkId)            }        },        mounted: function() {            this.initData();        }    })</script>

2.多选按钮

vue实现单选和多选功能

代码如下:

css样式:

<style>ul,li {    list-style-type: none;}{    margin: 0;    padding: 0;}.border-1px {    position: relative;}.border-1px:after {    display: block;    position: absolute;    left: 0;    bottom: 0;    width: 100%;    border-top: 1px solid rgba(7, 17, 27, .1);    content: ' ';}@media (-webkit-min-device-pixel-ratio: 1.5),    (min-device-pixel-ratio: 1.5) {        .border-1px::after {            -webkit-transform: scaleY(0.7);            transform: scaleY(0.7);        }    }@media (-webkit-min-device-pixel-ratio: 2),    (min-device-pixel-ratio: 2) {        .border-1px ::after {            -webkit-transform: scaleY(0.5);            transform: scaleY(0.5);        }    }#example {    margin: 20px;}h3 {    font-size: 26px;    margin-left: 20px;    height: 60px;}.self-checkbox {    display: none;}.self-checkbox+label {    margin-top: 16px;    -webkit-appearance: none;    background-color: #fff;    border: 2px solid #aaa;    border-radius: 5px;    display: inline-block;    position: relative;    width: 30px;    height: 30px;    box-sizing: border-box;    vertical-align: top;}.self-checkbox:checked+label {    border: 2px #47d9bf solid;}.self-checkbox:checked+label:after {    display: inline-block;    text-align: center;    content: '√';    width: 100%;    height: 30px;    line-height: 26px;    color: #47d9bf;    font-size: 18px;    text-shadow: 0px 0px 5px #47d9bf;}.check-area {    display: inline-block;    width: 400px;    padding: 12px 20px;    border: 1px solid #aaa;    border-top-left-radius: 4px;    border-top-right-radius: 4px;}li {    height: 60px;}li .self-radio+label {    vertical-align: middle;}li span {    margin-left: 20px;    display: inline-block;    line-height: 60px;    font-size: 22px;}p {    height: 60px;    line-height: 60px;    margin-left: 20px;}p span {    color: #f00;}.btn {    margin: 20px auto;    width: 100%;    text-align: center;}.btn button {    width: 120px;    height: 40px;    line-height: 30px;    font-size: 16px;    color: #fff;    background: #47d9bf;    border: 1px #23d5b6 solid;    border-radius: 6px;    text-align: center;    outline: none;}.btn button:hover {    background: #23d5b6;}</style>

html代码:

<div id="example">    <h3>多选按钮</h3>    <div class="check-area" v-show="items.length!=0">        <ul>            <li class="border-1px" v-for="(item,index) in items">                 <input class="self-checkbox" type="checkbox"                        :id="'checkbox-'+item.id"                        :data-id="'food-'+item.id" name="radio"                        :value="item.value" v-model="checkValues" @click="setCheckValue($event,item)">                 <label :for="'checkbox-'+item.id"></label>                 <span>{{item.value}}</span>             </li>        </ul>        <p>您选择了:<span v-show="checkValues.length">{{filterCheckValues}}</span></p>        <div class="btn"> <button @click="showCheck(checkIds)">按钮</button> <span v-show="checkIds.length">{{checkIds}}</span> </div>    </div></div>

js代码:

<script>    var itemData = [{        id: '20170811001',        value: '香蕉'    }, {        id: '20170811002',        value: '苹果'    }, {        id: '20170811003',        value: '梨子'    }, {        id: '20170811004',        value: '葡萄'    }] //itemData = [];     var vm = new Vue({        el: '#example',        data: {            items: '',            checkValues: [],            checkIds: []        },        computed: {            filterCheckValues: function() {                var value = this.checkValues;                var reValue = '';                for(var i = 0; i < value.length; i++) {                    reValue += value[i] + '、'                }                reValue = reValue.substring(0, reValue.length - 1) return reValue;            }        },        methods: {            initData: function() {                var self = this;                self.items = itemData;                if(itemData.length != 0) { //                       self.checkValues[0] = self.items[0].value; //                       self.checkIds[0] = 'food-' + self.items[0].id;                }            },            setCheckValue: function(ev, item) {                var id = 'food-' + item.id;                if(ev.target.checked) {                    this.checkIds.push(id);                } else if(this.checkIds.indexOf(id) > -1) {                    this.checkIds.remove(id);                }            },            showCheck: function() {                console.log(this.checkIds)            }        },        filter: {},        mounted: function() {            this.initData();        }    }) Array.prototype.remove = function(val) {        var index = this.indexOf(val);        if(index > -1) {            this.splice(index, 1);        }    };</script>



乐山网站制作乐山网站优化乐山建网站、乐山微信公众号运营、乐山网页设计、乐山微信小程序商城

400-111-6878
服务热线
顶部

备案号: 苏ICP备11067224号

CopyRight © 2011 书生商友信息科技 All Right Reserved

24小时服务热线:400-111-6878   E-MAIL:1120768800@qq.com   QQ:1120768800

  网址: http://www.768800.com  网站建设上往建站

关键词: 网站建设| 域名邮箱| 服务器空间| 网站推广| 上往建站| 网站制作| 网站设计| 域名注册| 网络营销| 网站维护|

企业邮箱| 虚拟主机| 网络建站| 网站服务| 网页设计| 网店美工设计| 网站定制| 企业建站| 网站设计制作| 网页制作公司|

400电话办理| 书生商友软件| 葬花网| 调温纤维| 海洋馆运营维护| 北京保安公司| 殡仪馆服务| 殡葬服务| 苏州殡葬一条龙| 朝阳殡葬| 苏州殡葬服务|

预约专家

欢迎您免费咨询,请填写以下信息,我们收到后会尽快与您联系

  

服务热线:400-111-6878