Skip to content

Commit

Permalink
feat: 新增 cssConverter样式转换器,安装文档更新
Browse files Browse the repository at this point in the history
新增 cssConverter样式转换器,安装文档更新
  • Loading branch information
hewx815 committed Jun 29, 2023
1 parent cf2752d commit ff829e7
Show file tree
Hide file tree
Showing 47 changed files with 839 additions and 317 deletions.
60 changes: 60 additions & 0 deletions .vitepress/components/PhoneCom.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<template>
<div class="phone dd">
<iframe :src="src" class="iframe"></iframe>
</div>
</template>

<script setup>
import { defineProps, computed } from 'vue';
console.log();
const props = defineProps({
name: {
type: String,
required: true
}
})
const src = computed(() => {
const baseUrl = process.env.NODE_ENV === 'production' ? '' : "http://localhost:8080/#/pages/"
return baseUrl + props.name
})
</script>

<style scoped>
::-webkit-scrollbar{display:none}
.phone {
width: 320px;
height: 568px;
box-shadow: 0px 0px 10px -4px var(--color-lighter);
border-radius: 2px;
position: fixed;
margin-top: 30px;
top: var(--vp-nav-height);
right: calc((100vw - var(--vp-layout-max-width)) / 2);
transition: .2s;
overflow: hidden;
z-index: 11;
}
.phone:hover{
box-shadow: 0px 0px 10px -2px var(--color-lighter);
}
.iframe{
width: 333px;
height: 568px;
margin: 0;
border-width: 0;
background-color: #fff;
}
@media screen and (max-width: 1280px) {
.phone{
display: none;
}
}
@media screen and (min-width: 1280px) and (max-width: 1400px) {
.phone{
right: 0;
}
}
</style>
1 change: 1 addition & 0 deletions .vitepress/components/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
// eslint-disable-next-line import/prefer-default-export
export { default as SupportTable } from './SupportTable.vue';
export { default as PhoneCom } from './PhoneCom.vue';
1 change: 1 addition & 0 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@ export default defineConfig({
},
// 链接图标
socialLinks: [{ icon: 'github', link: 'https://github.com/hewx815/h-uni' }],
outline: false,
},
});
3 changes: 2 additions & 1 deletion .vitepress/sidebar/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ export default [
text: 'for-vue2',
collapsed: false,
items: [
{ text: '按钮 button', link: '/for-vue2/components/HButton' },
{ text: '按钮 HButton', link: '/for-vue2/components/HButton' },
{ text: '标签栏 HTab', link: '/for-vue2/components/HTab' },
],
},
{
Expand Down
1 change: 1 addition & 0 deletions .vitepress/sidebar/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default [
collapsed: false,
items: [
{ text: 'Hhttp(网络请求)', link: '/for-vue2/utils/Hhttp' },
{ text: 'cssConverter(样式转换器)', link: '/for-vue2/utils/cssConverter' },
{ text: 'h-uni-build(扩展uni-build)', link: '/for-vue2/utils/vue-cli-plugin-h-uni-build' },
],
},
Expand Down
12 changes: 12 additions & 0 deletions .vitepress/theme/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,15 @@
--vp-c-green-dark: var(--color-dark);
--vp-c-green-darker: var(--color-darker);
}
.dark {
--color: rgb(95, 95, 205);
--color-light: rgb(115, 115, 205);
--color-lighter: rgb(255, 255, 255);
--color-dark: rgb(75, 75, 205);
--color-darker: rgb(45, 45, 205);
--vp-c-green: var(--color);
--vp-c-green-light: var(--color-light);
--vp-c-green-lighter: var(--color-lighter);
--vp-c-green-dark: var(--color-dark);
--vp-c-green-darker: var(--color-darker);
}
14 changes: 0 additions & 14 deletions .vitepress/theme/index.js

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svg.preview.background": "transparent"
}
60 changes: 50 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ npm run h-uni

如果您看到了正确的版本号证明已经成功安装

## 使用 for-vue2
## 注册 for-vue2

### 全局注册

注册全局组件以及挂载全部方法
**1.在项目的`main.js`中导入`Huni`,并使用`Vue``use`方法安装**

```js
// main.js
import Huni from "h-uni/for-vue2";
import Huni from "h-uni/dist/for-vue2";
import Vue from "vue";
import App from "./App.vue";

Expand All @@ -65,14 +65,54 @@ app.$mount();
```

::: info 全局方法的访问
在组件内通过`this.$h`访问`h-uni`方法

这一步成功把`Huni`的全部方法挂载到`this.$h``uni.$h`

使用`this.$h`或者`uni.$h`访问`h-uni`方法

:::

**2.配置easycom组件模式**

此配置需要在项目src目录的pages.json中进行。


```json
// pages.json
{
"easycom": {
"^H(.*)": "h-uni/dist/for-vue2/components/H$1/H$1.vue",
"^h-(.*)": "h-uni/dist/for-vue2/components+/h-$1/h-$1.vue"
},
// 此为本身已有的内容
"pages": [
// ......
]
}
```

::: info 温馨提示
1.uni-app为了调试性能的原因,修改easycom规则不会实时生效,配置完后,您需要重启HX或者重新编译项目才能正常使用uView的功能。

2.请确保您的pages.json中只有一个easycom字段,否则请自行合并多个引入规则。
:::

**3. Cli模式额外配置**

如果您是`vue-cli`模式的项目,还需要在项目`根目录``vue.config.js`文件中进行如下配置:

```js
// vue.config.js,如没有此文件则手动创建
module.exports = {
transpileDependencies: ['h-uni']
}
```

### 按需导入

#### 导入组件

`h-uni`组件位置:`h-uni/for-vue2/components`
`h-uni`组件位置:`h-uni/dist/for-vue2/components`

```vue
<template>
Expand All @@ -82,7 +122,7 @@ app.$mount();
</template>
<script>
import { Hbutton } from 'h-uni/for-vue2/components'
import { Hbutton } from 'h-uni/dist/for-vue2/components'
export default {
components:{ Hbutton },
};
Expand All @@ -91,17 +131,17 @@ export default {

#### 导入工具

`h-uni`工具位置:`h-uni/for-vue2/utils`
`h-uni`工具位置:`h-uni/dist/for-vue2/utils`

```js
import { Hhttp } from 'h-uni/for-vue2/utils'
import { Hhttp } from 'h-uni/dist/for-vue2/utils'

const request=new Hhttp({
baseUrl:'https://xxxxxx.xx'
})
```
::: warning 特殊工具
某些工具因为其导入使用方式特殊性可能会有所不同,以[工具相关文档](/for-vue2/utils/Hhttp.html)为准
::: warning 特殊工具以及组件
某些工具以及组件因为其导入使用方式特殊性可能会有所不同,以`相关文档`为准
:::

## 使用 for-vue3
Expand Down
1 change: 0 additions & 1 deletion for-vue2/index.js

This file was deleted.

1 change: 1 addition & 0 deletions for-vue2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"@dcloudio/uni-quickapp-webview": "^2.0.2-3070920230324001",
"@dcloudio/uni-stacktracey": "^2.0.2-3070920230324001",
"@dcloudio/uni-stat": "^2.0.2-3070920230324001",
"@dcloudio/uni-ui": "^1.4.28",
"@vue/shared": "^3.0.0",
"core-js": "^3.8.3",
"flyio": "^0.6.2",
Expand Down
4 changes: 2 additions & 2 deletions for-vue2/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export default {
};
</script>

<style>
/*每个页面公共css */
<style lang='scss'>
@import url('./packages/index.scss');
</style>
2 changes: 1 addition & 1 deletion for-vue2/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable promise/catch-or-return */
import Vue from 'vue';
import App from './App.vue';
import Huni from './packages';
import Huni from './packages/index';

Vue.use(Huni);
Vue.config.productionTip = false;
Expand Down
5 changes: 5 additions & 0 deletions for-vue2/src/packages/components+/h-button/h-button.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
import HButton from '../../components/HButton/HButton.vue';
export default HButton;
</script>
5 changes: 5 additions & 0 deletions for-vue2/src/packages/components+/h-tab-item/h-tab-item.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
import HTabItem from '../../components/HTabItem/HTabItem.vue';
export default HTabItem;
</script>
5 changes: 5 additions & 0 deletions for-vue2/src/packages/components+/h-tab/h-tab.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
import HColumnTab from '../../components/HColumnTab/HColumnTab.vue';
export default HColumnTab;
</script>
2 changes: 2 additions & 0 deletions for-vue2/src/packages/components+/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as HButton } from './h-button/h-button.vue';
export { default as HColumnTab } from './h-column-tab/h-column-tab.vue';
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
<template>
<view>
hbutton111111111
HButton1
</view>
</template>

<script>
export default {
data() {
return {
};
},
onLoad() {
},
methods: {
},
};
</script>

Expand Down
9 changes: 9 additions & 0 deletions for-vue2/src/packages/components/HButton/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
outline: false
---

<PhoneCom name="HButton"/>

# Hbutton

暂无

0 comments on commit ff829e7

Please sign in to comment.