Skip to content

Commit

Permalink
feat: eslint add
Browse files Browse the repository at this point in the history
  • Loading branch information
mehaotian committed Apr 16, 2019
1 parent af91348 commit 2c4195a
Show file tree
Hide file tree
Showing 28 changed files with 5,502 additions and 3,502 deletions.
3,327 changes: 2,504 additions & 823 deletions package-lock.json

Large diffs are not rendered by default.

35 changes: 33 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "@dcloudio/uni-ui",
"version": "0.0.7",
"version": "0.0.6",
"main": "lib/index.js",
"scripts": {
"lint": "eslint --fix --config package.json --ext .js --ext .vue packages/",
"serve": "npm run dev:h5",
"build:lib": "rm -rf lib && node ./build/build-lib.js",
"dev:h5": "cross-env NODE_ENV=development UNI_PLATFORM=h5 UNI_INPUT_DIR='./examples' vue-cli-service uni-serve"
Expand Down Expand Up @@ -32,7 +33,37 @@
"glob": "^7.1.3",
"node-sass": "^4.11.0",
"sass-loader": "^7.1.0",
"vue-template-compiler": "^2.6.9"
"vue-template-compiler": "^2.6.9",
"@vue/cli-plugin-eslint": "^3.4.1",
"eslint": "^5.5.0",
"eslint-config-standard": "^12.0.0",
"eslint-loader": "^2.1.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-promise": "^4.0.0",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^4.7.1",
"babel-eslint": "^7.2.3"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/recommended",
"standard"
],
"globals": {
"uni": true
},
"rules": {
"no-tabs": 0,
"standard/no-callback-literal": 0
},
"parserOptions": {
"parser": "babel-eslint"
}
},
"browserslist": [
"last 3 versions",
Expand Down
58 changes: 31 additions & 27 deletions packages/uni-badge/uni-badge.vue
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
<template>
<text class="uni-badge" v-if="text" :class="inverted ? 'uni-badge-' + type + ' uni-badge--' + size + ' uni-badge-inverted' : 'uni-badge-' + type + ' uni-badge--' + size" @click="onClick()">{{text}}</text>
<text
v-if="text"
:class="inverted ? 'uni-badge-' + type + ' uni-badge--' + size + ' uni-badge-inverted' : 'uni-badge-' + type + ' uni-badge--' + size"
class="uni-badge"
@click="onClick()">{{ text }}</text>
</template>

<script>
export default {
name: 'uni-badge',
props: {
type: {
type: String,
default: 'default'
},
inverted: {
type: Boolean,
default: false
},
text: {
type: [String, Number],
default: ''
},
size: { //small.normal
type: String,
default: 'normal'
}
},
methods: {
onClick() {
this.$emit('click')
}
}
}
export default {
name: 'UniBadge',
props: {
type: {
type: String,
default: 'default'
},
inverted: {
type: Boolean,
default: false
},
text: {
type: [String, Number],
default: ''
},
size: { // small.normal
type: String,
default: 'normal'
}
},
methods: {
onClick () {
this.$emit('click')
}
}
}
</script>

<style lang="scss">
Expand Down
779 changes: 387 additions & 392 deletions packages/uni-calendar/calendar.js

Large diffs are not rendered by default.

138 changes: 74 additions & 64 deletions packages/uni-calendar/uni-calendar-item.vue
Original file line number Diff line number Diff line change
@@ -1,73 +1,83 @@
<template>
<view>
<block v-for="(weeks, week) in canlender.weeks" :key="week">
<view class="uni-calender__body-date-week">
<block v-for="(day, index) in weeks" :key="index">
<view class="uni-calender__date" :class="{
'uni-calender__disable': canlender.month !== day.month || day.disable,
'uni-calender__date-current':
(day.date == canlender.date || day.checked) &&
canlender.month == day.month &&
!day.disable,
'uni-calender__lunar': lunar,
'uni-calender__active': day.isDay,
'uni-calender__is-day': day.isDay
}"
@tap="
selectDays(
week,
index,
canlender.month === day.month,
day.disable,
canlender.lunar
)
">
<view class="uni-calender__circle-box">
{{ day.date }}
<view v-if="lunar" class="uni-calender__lunar">{{ day.lunar }}</view>
<view v-if="day.have" class="uni-calender__data-circle"></view>
</view>
</view>
</block>
</view>
</block>
</view>
<view>
<block
v-for="(weeks, week) in canlender.weeks"
:key="week">
<view class="uni-calender__body-date-week">
<block
v-for="(day, index) in weeks"
:key="index">
<view
:class="{
'uni-calender__disable': canlender.month !== day.month || day.disable,
'uni-calender__date-current':
(day.date == canlender.date || day.checked) &&
canlender.month == day.month &&
!day.disable,
'uni-calender__lunar': lunar,
'uni-calender__active': day.isDay,
'uni-calender__is-day': day.isDay
}"
class="uni-calender__date"
@tap="
selectDays(
week,
index,
canlender.month === day.month,
day.disable,
canlender.lunar
)
">
<view class="uni-calender__circle-box">
{{ day.date }}
<view
v-if="lunar"
class="uni-calender__lunar">{{ day.lunar }}</view>
<view
v-if="day.have"
class="uni-calender__data-circle"/>
</view>
</view>
</block>
</view>
</block>
</view>
</template>

<script>
export default {
name: 'uni-calendar-item',
props: {
/**
export default {
name: 'UniCalendarItem',
props: {
/**
* 当前日期
*/
canlender: {
type: null,
default: () => {
return {};
}
},
lunar: {
type: Boolean,
default: false
}
},
data() {
return {};
},
created() {},
methods: {
selectDays(week, index, ischeck, isDay, lunar) {
this.$emit('selectDays', {
week,
index,
ischeck,
isDay,
lunar
});
}
}
};
canlender: {
type: null,
default: () => {
return {}
}
},
lunar: {
type: Boolean,
default: false
}
},
data () {
return {}
},
created () {},
methods: {
selectDays (week, index, ischeck, isDay, lunar) {
this.$emit('selectDays', {
week,
index,
ischeck,
isDay,
lunar
})
}
}
}
</script>

<style lang="scss">
Expand Down
Loading

0 comments on commit 2c4195a

Please sign in to comment.