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