1.0.3 • Published 6 years ago
hll-m-components v1.0.3
hll-m-components
货拉拉移动端公共组件库,适用于Vue2.x,可以按需引入
安装
npm install hll-m-components --save
使用
注册组件
// 引入 hll-m-components 主文件
import { cityList } from 'hll-m-components';
// 全局注册组件
Vue.component('city-list', cityList);
// 局部注册(此例子为单文件组件)
import { cityList } from 'hll-m-components';
export default {
components: {
cityList
}
}
在 .vue
单文件组件中使用:
<city-list :city-list-raw="cityList"
:current-city-id="currentCityId"
@chooseCity="getChoosedCity"
v-if="isShowCityList && cityList.length"></city-list>
参数及方法
选项 | 类型 | 是否必填 | 描述 |
---|---|---|---|
city-list-raw | Array | 必填 | 城市列表数据,货拉拉城市列表数据(数据结构为2018年使用的数据结构) |
current-city-id | Number or String | 必填 | 当前城市id |
chooseCity | Function | 必填 | 接受组件向外传递的选中城市的数据 |