1.0.1 • Published 5 years ago
mint-select v1.0.1
mint-select
基于 mint-ui 和 axios 模仿 ios 选择框,实现二级联动。 模仿原声的 select 框在手机端的展示,数据由后台提供。
Build Setup
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
# run unit tests
npm run unit
# run e2e tests
npm run e2e
# run all tests
npm test
####插件的使用 安装
npm install mint-select
引入依赖
import Vue from 'vue'
import App from './App'
import Mint from 'mint-ui'
Vue.use(Mint)
import 'mint-ui/lib/style.css'
import pickerAndSheets from 'mint-select'
Vue.use(pickerAndSheets)
import axios from 'axios'
Vue.prototype.$axios = axios
插件的使用
<mintSelect v-bind:parentData="parentData"
@func="getModelOrBrand">
</mintSelect>
插件之前的传值
export default {
name: "App",
components: {},
data() {
return {
parentData: {
postUrl: "/wx/condition", //第一个select获取数据请求的地址
subPostUrl: "/wx/getBrandByModel?modelid=", //第二个select获取数据请求的地址
subShow: true, //是否显示第二个select
param: {
test: "123" //第一个 请求所携带的参数,也可以不传默认为{}
}
}
};
},
methods: {
//emit子父组件传值
//子组件传递给父组件的值,就是选择的select的内容
getModelOrBrand(data) {
this.param.brandId = data.brand;
this.param.modelId = data.model;
}
}
};
For a detailed explanation on how things work, check out the guide and docs for vue-loader.