首页 > 其他分享 >前端Vue自定义简单实用中国省市区三级联动选择器

前端Vue自定义简单实用中国省市区三级联动选择器

时间:2023-06-20 09:24:21浏览次数:50  
标签:ccInputView Vue 自定义 .. 36px margin 选择器

前端Vue自定义简单实用中国省市区三级联动选择器, 请访问uni-app插件市场地址:https://ext.dcloud.net.cn/plugin?id=13118

效果图如下:

使用方法


<!-- themeColor:主题颜色 ref:设置唯一ref pickerValueDefault:默认选择 @onCancel:取消事件 @onConfirm:确认事件 -->

<cc-city-picker :themeColor="themeColor" ref="mpvueCityPicker" :pickerValueDefault="cityPickerValueDefault"

@onCancel="onCancel" @onConfirm="onConfirm"></cc-city-picker>

HTML代码实现部分


<template>

<view class="content">

<form @submit="formSubmit" @reset="formReset">

<!-- leftTitle:左边标题 name:输入框名字 value:输入框选择值  placeholder:占位符 @click:点击事件-->

<ccInputSelView leftTitle="收获地址" name="location" :value="pickerText" placeholder="请选择位置"

@click="showMulLinkageThreePicker"></ccInputSelView>

<ccInputView leftTitle="详细地址" name="address" :value="address" placeholder="请输入详细地址">

</ccInputView>

<!-- themeColor:主题颜色 ref:设置唯一ref pickerValueDefault:默认选择 @onCancel:取消事件 @onConfirm:确认事件 -->

<cc-city-picker :themeColor="themeColor" ref="mpvueCityPicker" :pickerValueDefault="cityPickerValueDefault"

@onCancel="onCancel" @onConfirm="onConfirm"></cc-city-picker>

<view class="uni-btn-v">

<button class="botBtn" type="primary" form-type="submit">下一步</button>

<view class="tipText"> 注意事项: 请确保您填写的房屋信息真实无误 </view>

</view>

</form>

</view>

</template>

<script>

import ccInputSelView from '../../components/cc-inputSelView/ccInputSelView.vue'

import ccInputView from '../../components/cc-inputSelView/ccInputView.vue'

export default {

components: {

ccInputSelView,

ccInputView

},

data() {

return {

cityPickerValueDefault: [0, 0, 1],

themeColor: '#0BBBEF',

pickerText: '',

address: ''

}

},

methods: {

// 三级联动选择

showMulLinkageThreePicker() {

this.$refs.mpvueCityPicker.show()

},

onConfirm(e) {

this.pickerText = e.label

},

onCancel(e) {

console.log(e)

},

formSubmit: function(e) {

console.log('form发生了submit事件,携带数据为:' + JSON.stringify(e));

var formdata = e.detail.value;

uni.showModal({

title: '温馨提示',

content: 'formsubmit事件携带数据为:' + JSON.stringify(e.detail.value)

})

},

}

}

</script>

<style>

.content {

display: flex;

flex-direction: column;

}

.uni-btn-v {

width: 100%;

height: auto;

}

.botBtn {

width: 90%;

margin-top: 36px;

}

.tipText {

width: 100%;

margin-left: 0px;

text-align: center;

color: #666666;

margin-top: 36px;

margin-bottom: 36px;

font-size: 28rpx;

}

</style>

标签:ccInputView,Vue,自定义,..,36px,margin,选择器
From: https://www.cnblogs.com/ccVue/p/17492741.html

相关文章

  • 京东微前端应用MicroApp,主应用vite-vue3,子应用vite-vue3+pinia
    micro-app官方地址micro-app官方demo地址这篇文章主要是为了记录,本人在使用中遇到的一些问题,供参考资源找不到->本地使用代理,显示nginx转发子应用使用组件插槽或者pinia,路由懒加载报错问题->小项目几个路由不要懒加载,大项目中懒加载的时候不要使用pinia或者组件中不适用......
  • 前端Vue自定义询问弹框和输入弹框
    前端Vue自定义询问弹框和输入弹框,下载完整代码请访问uni-app插件市场地址:https://ext.dcloud.net.cn/plugin?id=13119效果图如下:使用方法<!--提示框--><cc-defineDialogBoxref="DialogBox"></cc-defineDialogBox>//显示询问弹框showDialogBox(){this.$refs['D......
  • 前端Vue自定义服务说明弹窗弹框 自下而上底部弹框
    前端Vue自定义服务说明弹窗弹框自下而上底部弹框,请访问uni-app插件市场地址:https://ext.dcloud.net.cn/plugin?id=13108效果图如下:cc-serviceDialog自定义服务说明弹窗自下而上底部弹窗使用方法<!--服务组件弹窗close:关闭事件class:定义类(显示或隐藏) --><cc......
  • 将 Vue 项目部署到 Nginx 上
    将Vue项目部署到Nginx上安装Nginx下载地址:nginx:download(1)因为我在Windows系统下安装Nginx,所以选择nginx/Windows-1.22.1。下载的资源是一个压缩包,解压后即可使用。(2)打开命令行提示符(cmd),切换到Nginx的根目录,启动Nginx服务器。cd/DD:/software/nginx-1.22.1......
  • vue el-input 输入框 限制小数点后 只能有三位小数
     ​​oninput="if(value.indexOf('.')>0){value=value.slice(0,value.indexOf('.')+4)}"​​  ......
  • vue中使用axios
    引入axios错误用法在main.js中引入,需要注意的是,因为axios是第三方库,不是vue的插件,所以下面的这种写法不支持。importaxiosfrom'axios';Vue.use(axios)正确用法结合vue-axios使用,vue-axios是将axios集成到Vue.js的小包装器,可以像插件一样进行安装,具体用法是:安装......
  • vue通信-provide&inject
    刚完成一个需求,父组件开启一个任务,开启后孙组件显示一个执行按钮,在孙组件中点击执行按钮,再到父组件中执行任务并隐藏按钮;可以使用props和emit实现,因为组件层级较多,所以考虑使用provide&inject实现父组件和孙组件的通信;以下代码记录实现过程:父组件:Parent.vue<template> <div>......
  • Html使用Vue3+ElementPlus(图标 ElMessage)
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"/><metahttp-equiv="X-UA-Compatible"content="IE=edge"/><metaname="viewport"content="wid......
  • TensorFlow07 神经网络-自定义网络
    ▪keras.Sequential▪keras.layers.Layer▪keras.Model1keras.Sequential这样就完成了五层的神经网络的一个搭建,然后我们在activation中也可以指定每一层的激活函数2model.trainable_variables▪model.trainable_variables▪model.call()model.trainable_variabl......
  • 自定义 v-model 指令
    //two.jsexportdefault{bind(el,binding,vnode){console.log(binding);el.value=binding.valueif(/\.async/.test(binding.rawName)){el.onchange=handleFn;}else{el.oninput=handleFn;......