# location-ui

> 58招聘小程序组件库

Latest version **1.0.42** (published 2023-11-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install location-ui
pnpm add location-ui
yarn add location-ui
bun add location-ui
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.42 |
| Published | 2023-11-09 |
| First published | 2022-11-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 1.3 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | 58fe |
| Maintainers | jiale1 |

## Links

- npm: https://www.npmjs.com/package/location-ui
- npm.io page: https://npm.io/package/location-ui

## Dependencies (4)

- [vue](https://npm.io/package/vue.md) ^3.2.42
- [vue-router](https://npm.io/package/vue-router.md) ^4.1.6
- [vite-plugin-md](https://npm.io/package/vite-plugin-md.md) 0.11.8
- [@nutui/icons-vue](https://npm.io/package/@nutui/icons-vue.md) ^0.0.25

## Recent versions

- 1.0.42 (latest) — 2023-11-09
- 1.0.42-beta.0 (beta) — 2023-10-27
- 1.0.42-mulina.0 (mulina) — 2023-10-27
- 1.0.42-beta.3 (jialei03) — 2023-10-27
- 1.0.16 — 2023-08-11
- 1.0.15 — 2023-08-09
- 1.0.14 — 2023-04-06
- 1.0.13 — 2023-02-17
- 1.0.12 — 2023-02-17
- 1.0.11 — 2023-02-17
- 1.0.10 — 2023-02-17
- 1.0.9 — 2023-02-16
- 1.0.8 — 2023-02-16
- 1.0.7 — 2023-02-16
- 1.0.6 — 2022-12-22
- … 6 more at https://npm.io/package/location-ui/versions

## README

# location-ui

## 官网地址链接

https://h5-cdn.58.com/git/hrg-fe/zp-tongzhen/location-ui/1x/index.html#/zh-CN/

## install

```bash
npm i location-ui -S
```

## 全局引入

### 配置 taro 插件 @tarojs/plugin-html

- 首先下载 @tarojs/plugin-html

```bash
npm i @tarojs/plugin-html -D
```

- 在项目中配置

```javascript
// config/index.js
config = {
  // ...
  plugins: ['@tarojs/plugin-html']
  // 给 sass-loader 传递选项 ！！！！ 按需加载方式必须配置
  sass: {
      data: `@import "location-ui/dist/styles/variables.scss";`,
  }
}
```

- 配置 375 尺寸

```javascript
// config/index.js
config = {
  // ...
  designWidth: 375,
  deviceRatio: {
    640: 2.34 / 2,
    750: 1,
    828: 1.81 / 2,
    375: 2 / 1,
  },
};
```

- npm 使用示例

```javascript
// app.ts
import { createApp } from "vue";
import LocationUI from "location-ui";
import "location-ui/dist/style.css";
import "./app.scss";

const App = createApp({
  onShow(options) {},
  // 入口组件不需要实现 render 方法，即使实现了也会被 taro 所覆盖
});

App.use(LocationUI);
export default App;
```

## 按需引入

- `app.ts`

```javascript
import { Button } from "location-ui";
App.use(Button);
```

- 使用

```vue
<location-button>button</location-button>
```

- 安装 babel-plugin-import

```bash
npm install babel-plugin-import --save-dev
```

- 配置 `babel.config.js`:

```javascript
plugins: [
  [
    "import",
    {
      libraryName: "location-ui",
      libraryDirectory: "dist/packages/_es",
      // customName自定义兼容国际化使用
      customName: (name, file) => {
        if (name == "Locale") {
          return "location-ui/dist/packages/locale/lang";
        } else {
          return `location-ui/dist/packages/_es/${name}`;
        }
      },
      style: (name, file) =>
        name.toLowerCase().replace("_es/", "") + "/index.scss",
      camel2DashComponentName: false,
    },
    "location-ui",
  ],
];
```

### 安装 css

- 配置 `config/index.js`

```javascript
sass: {
    data: `@import "location-ui/dist/styles/variables.scss";`,
  },
```

## 预览步骤：

- `pnpm i` (node 版本 >14.6)
- `pnpm run build:taro:vue`
- `pnpm dev:taro:weapp`（如果缺少依赖需要先 `cd src/sites/mobile-taro/ && yarn`，再返回项目根运行）

## 开发步骤：

- `pnpm run add`，执行添加新组件脚本。该脚本会自动生成该组件目录、`config.json` 内该组件的配置信息等
- `pnpm run dev:taro:weapp`，执行开发环境预览 taro 小程序文档脚本。该脚本会生成小程序文档路由，打开微信开发者工具预览 `dist/miniProgram`

## 官网预览

- `pnpm run dev`

## 官网构建

- `pnpm run build:site`，生成两部分：一部分 PC 网页，另一部分基于 taro 打包成 h5 的预览 iframe

---
_Source: https://npm.io/package/location-ui · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
