Skip to content

样式改为less, 修改打包报错 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/recycle-list-demo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ Thumbs.db
/coverage

/logs

./package-lock.json
8,282 changes: 8,282 additions & 0 deletions examples/recycle-list-demo/package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions examples/recycle-list-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"eslint": "^6.8.0",
"eslint-plugin-ux": "^0.0.4",
"hap-toolkit": "^0.7.4",
"less": "^3.12.2",
"less-loader": "^6.2.0",
"npm-run-all": "^4.1.5"
}
}
37 changes: 37 additions & 0 deletions examples/recycle-list-demo/src/List/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

.demo-page {
flex-direction: column;

.title {
height: 100px;
justify-content: center;
background-color: #EEEEEE;
text {
font-size: 40px;
}
}

.list {
flex-grow: 1;
flex-direction: column;
.item {
padding: 10px;
left: 0;
.index {
width: 60px;
}
.item-left {
image {
height: 130px;
width: 130px;;
}
}
.item-right {
padding: 20px;
flex-direction: column;
justify-content: space-around;
}
}
}
}

47 changes: 6 additions & 41 deletions examples/recycle-list-demo/src/List/index.ux
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<template>
<!-- template里只能有一个根节点 -->
<div class="demo-page">
<div class="title">
<text>list top</text>
</div>
<list class="list">
<list-item class="item" for="{{partListData}}" onresize="onItemResize">
<list-item class="item" for="{{partListData}}" type="list-item" onresize="onItemResize">
<div class="index">
<text>{{$idx}}</text>
</div>
Expand All @@ -16,7 +19,7 @@
</list-item>
</list>
<div class="title">
<text>list组件实现</text>
<text>list bottom</text>
</div>
</div>
</template>
Expand All @@ -33,43 +36,5 @@ export default {
}
</script>

<style>
.demo-page {
width: 100%;
height: 100%;
flex-direction: column;
}

.list{
flex-grow: 1;
width: 100%;
height: 100%;
flex-direction: column;
}
.item {
padding: 10px;
left:0;
/*position: absolute;*/
}
.item .index{
width: 60px;
}
.item .item-left image {
height: 130px;
width: 130px;
}
.item .item-right {
padding: 20px;
flex-direction: column;
justify-content: space-around;
}

.title {
height: 130px;
justify-content: center;
background-color: #EEEEEE;
}
.title text{
font-size: 40px;
}
<style lang="less" src="./index.less">
</style>
36 changes: 36 additions & 0 deletions examples/recycle-list-demo/src/Recycle-list/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

.demo-page {
flex-direction: column;

.title {
height: 100px;
justify-content: center;
background-color: #EEEEEE;
text{
font-size: 40px;
}
}

.list{
flex-grow: 1;
.item {
padding: 10px;
left:0;
position: absolute;
.index{
width: 120px;
}
.item-left {
image {
height: 130px;
width: 130px;;
}
}
.item-right {
padding: 20px;
flex-direction: column;
justify-content: space-around;
}
}
}
}
57 changes: 14 additions & 43 deletions examples/recycle-list-demo/src/Recycle-list/index.ux
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<template>
<!-- template里只能有一个根节点 -->
<div class="demo-page">
<div class="title">
<text>recycle list top</text>
</div>
<div class="list" ontouchmove="onMove" ontouchstart="onStart" ontouchend="onTouchEnd" onresize="onViewResize">
<div style="top:{{ getItemTop($item) }}px" class="item" for="{{partListData}}" onresize="onItemResize">
<div class="index">
Expand All @@ -27,12 +30,17 @@ import { loopInertiaMove } from './index'

const fullListData = getMenuList()

let length = 9 // 渲染的item个数
// 渲染的item个数
let length = 9

let nextDataIndex = length // 列表中下一个数据指向
let lastClientY = 0 // 记录上次滑到Y轴位置
let lastMoveTime = 0 // 上次滑动时间
let speed = 0 // 记录滑动速度
// 列表中下一个数据指向
let nextDataIndex = length
// 记录上次滑到Y轴位置
let lastClientY = 0
// 上次滑动时间
let lastMoveTime = 0
// 记录滑动速度
let speed = 0

function getLastTop(listOffsetY, itemHeight) {
return (length - 1) * itemHeight + listOffsetY
Expand Down Expand Up @@ -148,42 +156,5 @@ export default {
}
</script>

<style>
.demo-page {
width: 100%;
height: 100%;
flex-direction: column;
}

.list{
flex-grow: 1;
width: 100%;
height: 100%;
}
.item {
padding: 10px;
left:0;
position: absolute;
}
.item .index{
width: 120px;
}
.item .item-left image {
height: 130px;
width: 130px;
}
.item .item-right {
padding: 20px;
flex-direction: column;
justify-content: space-around;
}
.title {
height: 130px;
justify-content: center;
background-color: #EEEEEE;
}

.title text{
font-size: 40px;
}
<style lang="less" src="./index.less">
</style>
3 changes: 0 additions & 3 deletions examples/recycle-list-demo/src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
"versionCode": "1",
"minPlatformVersion": "1020",
"icon": "/Common/logo.png",
"deviceTypeList": [
"phone"
],
"features": [
{
"name": "system.prompt"
Expand Down