提交 8428bc4c 作者: 方治民

合并分支 '3.x' 到 'main'

3.x

查看合并请求 !35
...@@ -66,21 +66,21 @@ ...@@ -66,21 +66,21 @@
} }
}, },
"dependencies": { "dependencies": {
"@dcloudio/uni-app": "3.0.0-alpha-3080320230523001", "@dcloudio/uni-app": "3.0.0-3080320230526001",
"@dcloudio/uni-app-plus": "3.0.0-alpha-3080320230523001", "@dcloudio/uni-app-plus": "3.0.0-3080320230526001",
"@dcloudio/uni-components": "3.0.0-alpha-3080320230523001", "@dcloudio/uni-components": "3.0.0-3080320230526001",
"@dcloudio/uni-h5": "3.0.0-alpha-3080320230523001", "@dcloudio/uni-h5": "3.0.0-3080320230526001",
"@dcloudio/uni-mp-alipay": "3.0.0-alpha-3080320230523001", "@dcloudio/uni-mp-alipay": "3.0.0-3080320230526001",
"@dcloudio/uni-mp-baidu": "3.0.0-alpha-3080320230523001", "@dcloudio/uni-mp-baidu": "3.0.0-3080320230526001",
"@dcloudio/uni-mp-jd": "3.0.0-alpha-3080320230523001", "@dcloudio/uni-mp-jd": "3.0.0-3080320230526001",
"@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-3080320230523001", "@dcloudio/uni-mp-kuaishou": "3.0.0-3080320230526001",
"@dcloudio/uni-mp-lark": "3.0.0-alpha-3080320230523001", "@dcloudio/uni-mp-lark": "3.0.0-3080320230526001",
"@dcloudio/uni-mp-qq": "3.0.0-alpha-3080320230523001", "@dcloudio/uni-mp-qq": "3.0.0-3080320230526001",
"@dcloudio/uni-mp-toutiao": "3.0.0-alpha-3080320230523001", "@dcloudio/uni-mp-toutiao": "3.0.0-3080320230526001",
"@dcloudio/uni-mp-weixin": "3.0.0-alpha-3080320230523001", "@dcloudio/uni-mp-weixin": "3.0.0-3080320230526001",
"@dcloudio/uni-quickapp-webview": "3.0.0-alpha-3080320230523001", "@dcloudio/uni-quickapp-webview": "3.0.0-3080320230526001",
"@dcloudio/uni-ui": "^1.4.27", "@dcloudio/uni-ui": "^1.4.27",
"@faker-js/faker": "^8.0.1", "@faker-js/faker": "^8.0.2",
"@vue/runtime-core": "~3.2.47", "@vue/runtime-core": "~3.2.47",
"@vueuse/core": "^10.1.2", "@vueuse/core": "^10.1.2",
"axios": "^1.4.0", "axios": "^1.4.0",
...@@ -102,15 +102,15 @@ ...@@ -102,15 +102,15 @@
"@commitlint/cli": "^17.6.3", "@commitlint/cli": "^17.6.3",
"@commitlint/config-conventional": "^17.6.3", "@commitlint/config-conventional": "^17.6.3",
"@dcloudio/types": "^3.3.3", "@dcloudio/types": "^3.3.3",
"@dcloudio/uni-automator": "3.0.0-alpha-3080320230523001", "@dcloudio/uni-automator": "3.0.0-3080320230526001",
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3080320230523001", "@dcloudio/uni-cli-shared": "3.0.0-3080320230526001",
"@dcloudio/uni-helper-json": "^1.0.13", "@dcloudio/uni-helper-json": "^1.0.13",
"@dcloudio/uni-stacktracey": "3.0.0-alpha-3080320230523001", "@dcloudio/uni-stacktracey": "3.0.0-3080320230526001",
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-3080320230523001", "@dcloudio/vite-plugin-uni": "3.0.0-3080320230526001",
"@iconify/json": "^2.2.68", "@iconify/json": "^2.2.71",
"@types/crypto-js": "^4.1.1", "@types/crypto-js": "^4.1.1",
"@types/lodash-es": "^4.17.7", "@types/lodash-es": "^4.17.7",
"@types/node": "^18.16.14", "@types/node": "^18.16.16",
"@types/prettier": "^2.7.2", "@types/prettier": "^2.7.2",
"@types/qs": "^6.9.7", "@types/qs": "^6.9.7",
"@types/stompjs": "^2.3.5", "@types/stompjs": "^2.3.5",
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
"eslint": "^8.41.0", "eslint": "^8.41.0",
"eslint-config-prettier": "^8.8.0", "eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^9.14.0", "eslint-plugin-vue": "^9.14.1",
"husky": "^8.0.3", "husky": "^8.0.3",
"jest": "27.0.4", "jest": "27.0.4",
"jest-environment-node": "27.5.1", "jest-environment-node": "27.5.1",
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"picocolors": "^1.0.0", "picocolors": "^1.0.0",
"pont-engine": "^1.5.10", "pont-engine": "^1.5.10",
"postcss": "^8.4.23", "postcss": "^8.4.24",
"postcss-html": "^1.5.0", "postcss-html": "^1.5.0",
"postcss-less": "^6.0.0", "postcss-less": "^6.0.0",
"prettier": "^2.8.8", "prettier": "^2.8.8",
...@@ -149,11 +149,11 @@ ...@@ -149,11 +149,11 @@
"stylelint-config-standard": "^33.0.0", "stylelint-config-standard": "^33.0.0",
"stylelint-order": "^6.0.3", "stylelint-order": "^6.0.3",
"typescript": "^5.0.4", "typescript": "^5.0.4",
"unocss": "^0.52.3", "unocss": "^0.52.4",
"unocss-preset-weapp": "^0.6.3", "unocss-preset-weapp": "^0.6.3",
"unplugin-auto-import": "^0.16.2", "unplugin-auto-import": "^0.16.2",
"unplugin-vue-components": "^0.24.1", "unplugin-vue-components": "^0.24.1",
"vite": "^4.3.8", "vite": "^4.3.9",
"vue-eslint-parser": "^9.3.0" "vue-eslint-parser": "^9.3.0"
}, },
"engines": { "engines": {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -124,11 +124,12 @@ ...@@ -124,11 +124,12 @@
}, },
methods: { methods: {
getColor(type) { getColor(type) {
const color = "#465CFF" const app = uni && uni.$fui && uni.$fui.color
const color = (app && app.primary) || "#465CFF"
const colors = { const colors = {
'success': '#09BE4F', 'success': (app && app.success) || '#09BE4F',
'warn': '#FFB703', 'warn': (app && app.warning) || '#FFB703',
'clear': '#FF2B2B' 'clear': (app && app.danger) || '#FF2B2B'
} }
return colors[type] ? colors[type] : color; return colors[type] ? colors[type] : color;
}, },
......
<template> <template>
<text <text
:class="[dot?'fui-badge__dot':'fui-badge__wrap',background?'':('fui-badge__bg-'+type),absolute?'fui-badge__absolute':'',scaleRatio!=1 && isNvue?'fui-badge__trans-origin':'',!background && type==='white'?'fui-badge__text-color':'']" :class="[dot?'fui-badge__dot':'fui-badge__wrap',background?'':('fui-badge__bg-'+type),absolute?'fui-badge__absolute':'',scaleRatio!=1 && isNvue?'fui-badge__trans-origin':'',!background && type==='white'?'fui-badge__text-color':'']"
:style="{top:absolute?top:'auto',right:absolute?right:'auto',zoom:scaleRatio,transform:isNvue?`scale(${scaleRatio})`:'scale(1)',marginTop:marginTop+'rpx',marginLeft:marginLeft+'rpx',marginRight:marginRight+'rpx',width:width,color:color,background:background}" :style="{top:absolute?top:'auto',right:absolute?right:'auto',zoom:scaleRatio,transform:isNvue?`scale(${scaleRatio})`:'scale(1)',marginTop:marginTop+'rpx',marginLeft:marginLeft+'rpx',marginRight:marginRight+'rpx',width:width,color:color,background:getBgColor}"
@tap="handleClick" v-if="showValue || dot">{{dot?'':showValue}}</text> @tap="handleClick" v-if="showValue || dot">{{dot?'':showValue}}</text>
</template> </template>
...@@ -83,6 +83,27 @@ ...@@ -83,6 +83,27 @@
showValue: '' showValue: ''
}; };
}, },
computed: {
getBgColor() {
let color = this.background
// #ifdef APP-NVUE
if (!color && this.type) {
//primary,success,warning,danger,purple,white
const app = uni && uni.$fui && uni.$fui.color
const colors = {
primary: (app && app.primary) || '#465CFF',
success: (app && app.success) || '#09BE4F',
warning: (app && app.warning) || '#FFB703',
danger: (app && app.danger) || '#FF2B2B',
purple: (app && app.purple) || '#6831FF',
white: '#FFFFFF'
}
color = colors[this.type] || colors.primary
}
// #endif
return color
}
},
watch: { watch: {
value(val) { value(val) {
this.getWidth() this.getWidth()
...@@ -180,30 +201,6 @@ ...@@ -180,30 +201,6 @@
/* #endif */ /* #endif */
/* #ifdef APP-NVUE */ /* #ifdef APP-NVUE */
.fui-badge__bg-primary {
background-color: #465CFF !important;
}
.fui-badge__bg-success {
background-color: #09BE4F !important;
}
.fui-badge__bg-warning {
background-color: #FFB703 !important;
}
.fui-badge__bg-danger {
background-color: #FF2B2B !important;
}
.fui-badge__bg-purple {
background-color: #6831FF !important;
}
.fui-badge__bg-white {
background-color: #FFFFFF !important;
}
.fui-badge__text-color { .fui-badge__text-color {
color: #FF2B2B !important; color: #FF2B2B !important;
} }
......
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
}, },
right: { right: {
type: [Number, String], type: [Number, String],
default: 8 default: 0
}, },
top: { top: {
type: [Number, String], type: [Number, String],
......
<template> <template>
<view class="fui-button__wrap" <view class="fui-button__wrap"
:class="[!width || width==='100%' || width===true?'fui-button__flex-1':'',disabled && !disabledBackground ? 'fui-button__opacity' : '']" :class="[!getWidth || getWidth==='100%' || getWidth===true?'fui-button__flex-1':'',disabled && !disabledBackground ? 'fui-button__opacity' : '']"
:style="{width: width,height: getHeight,marginTop:margin[0] || 0, marginRight:margin[1]||0,marginBottom:margin[2] || margin[0]||0,marginLeft:margin[3] || margin[1]||0,borderRadius: getRadius,background:getBackground}" :style="{width: getWidth,height: getHeight,marginTop:margin[0] || 0, marginRight:margin[1]||0,marginBottom:margin[2] || margin[0]||0,marginLeft:margin[3] || margin[1]||0,borderRadius: getRadius,background:getBackground}"
@touchstart="handleStart" @touchend="handleClick" @touchcancel="handleEnd"> @touchstart="handleStart" @touchend="handleClick" @touchcancel="handleEnd">
<button class="fui-button" :class="[ <button class="fui-button" :class="[
bold ? 'fui-text__bold' : '', bold ? 'fui-text__bold' : '',
time && (plain || type==='link') ? 'fui-button__opacity' : '', time && (plain || type==='link') ? 'fui-button__opacity' : '',
!background && !disabledBackground && !plain?('fui-button__'+type):'', !background && !disabledBackground && !plain?('fui-button__'+type):'',
!width || width==='100%' || width===true?'fui-button__flex-1':'', !getWidth || getWidth==='100%' || getWidth===true?'fui-button__flex-1':'',
time && !plain && type!=='link' ? 'fui-button__active' : '', time && !plain && type!=='link' ? 'fui-button__active' : '',
pc && !disabled?(plain || type==='link'?'fui-button__opacity-pc':'fui-button__active-pc'):'', pc && !disabled?(plain || type==='link'?'fui-button__opacity-pc':'fui-button__active-pc'):'',
]" :style="{ ]" :style="{
width: width, width: getWidth,
height: getHeight, height: getHeight,
lineHeight: getHeight, lineHeight: getHeight,
background: disabled ? (disabledBackground || getTypeColor) : (plain ? 'transparent' : getBackground), background: disabled ? (disabledBackground || getTypeColor) : (plain ? 'transparent' : getBackground),
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
borderRadius: getRadius, borderRadius: getRadius,
fontSize: getSize, fontSize: getSize,
color: getColor color: getColor
}" :loading="loading" :form-type="formType" :open-type="openType" :app-parameter="appParameter" @getuserinfo="bindgetuserinfo" }" :loading="loading" :form-type="formType" :open-type="openType" :app-parameter="appParameter"
@getphonenumber="bindgetphonenumber" @contact="bindcontact" @error="binderror" @getuserinfo="bindgetuserinfo" @getphonenumber="bindgetphonenumber" @contact="bindcontact"
@opensetting="bindopensetting" @chooseavatar="bindchooseavatar" @launchapp="bindlaunchapp" @error="binderror" @opensetting="bindopensetting" @chooseavatar="bindchooseavatar"
:disabled="disabled" :scope="scope" @tap.stop="handleTap"> @launchapp="bindlaunchapp" :disabled="disabled" :scope="scope" @tap.stop="handleTap">
<text class="fui-button__text" <text class="fui-button__text"
:class="{'fui-btn__gray-color':!background && !disabledBackground && !plain && type==='gray' && color==='#fff','fui-text__bold':bold}" :class="{'fui-btn__gray-color':!background && !disabledBackground && !plain && type==='gray' && color==='#fff','fui-text__bold':bold}"
v-if="text" v-if="text"
...@@ -44,10 +44,11 @@ ...@@ -44,10 +44,11 @@
export default { export default {
name: 'fui-button', name: 'fui-button',
emits: ['click', 'getuserinfo', 'contact', 'getphonenumber', 'error', 'opensetting'], emits: ['click', 'getuserinfo', 'contact', 'getphonenumber', 'error', 'opensetting'],
// #ifndef VUE3
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
behaviors: ['wx://form-field-button'], behaviors: ['wx://form-field-button'],
// #endif // #endif
// #ifdef MP-BAIDU || MP-QQ
behaviors: ['uni://form-field'],
// #endif // #endif
props: { props: {
//样式类型:primary,success, warning,danger,link,purple,gray //样式类型:primary,success, warning,danger,link,purple,gray
...@@ -96,6 +97,11 @@ ...@@ -96,6 +97,11 @@
type: String, type: String,
default: '' default: ''
}, },
//按钮大小,优先级高于width和height,medium、small、mini
btnSize: {
type: String,
default: ''
},
//宽度 //宽度
width: { width: {
type: String, type: String,
...@@ -167,13 +173,14 @@ ...@@ -167,13 +173,14 @@
// #ifndef APP-NVUE // #ifndef APP-NVUE
return ''; return '';
// #endif // #endif
const app = uni && uni.$fui && uni.$fui.color
let colors = { let colors = {
primary: '#465CFF', primary: (app && app.primary) || '#465CFF',
success: '#09BE4F', success: (app && app.success) || '#09BE4F',
warning: '#FFB703', warning: (app && app.warning) || '#FFB703',
danger: '#FF2B2B', danger: (app && app.danger) || '#FF2B2B',
link: 'transparent', link: 'transparent',
purple: '#6831FF', purple: (app && app.purple) || '#6831FF',
gray: '#F8F8F8' gray: '#F8F8F8'
} }
return colors[this.type] || 'transparent' return colors[this.type] || 'transparent'
...@@ -196,18 +203,44 @@ ...@@ -196,18 +203,44 @@
if (this.disabled && this.disabledBackground) { if (this.disabled && this.disabledBackground) {
color = this.disabledColor || '#FFFFFF' color = this.disabledColor || '#FFFFFF'
} else { } else {
color = this.type === 'gray' ? '#465CFF' : '#FFFFFF' const app = uni && uni.$fui && uni.$fui.color;
const primary = (app && app.primary) || '#465CFF';
color = this.type === 'gray' ? primary : '#FFFFFF'
} }
} }
return color; return color;
}, },
getSize() { getSize() {
const size = (uni && uni.$fui && uni.$fui.fuiButton && uni.$fui.fuiButton.size) || 32 let size = this.size || (uni && uni.$fui && uni.$fui.fuiButton && uni.$fui.fuiButton.size) || 32
return `${this.size || size}rpx` if (this.btnSize === 'small') {
size = size > 28 ? 28 : size;
} else if (this.btnSize === 'mini') {
size = size > 28 ? 24 : size;
}
return `${size}rpx`
},
getWidth() {
//medium 400*84 / small 200*84/ mini 120 * 64
let width = this.width;
if (this.btnSize && this.btnSize !== true) {
width = {
'medium': '400rpx',
'small': '200rpx',
'mini': '120rpx'
} [this.btnSize] || width
}
return width
}, },
getHeight() { getHeight() {
const height = (uni && uni.$fui && uni.$fui.fuiButton && uni.$fui.fuiButton.height) || '96rpx' let height = this.height || (uni && uni.$fui && uni.$fui.fuiButton && uni.$fui.fuiButton.height) || '96rpx'
return this.height || height if (this.btnSize && this.btnSize !== true) {
height = {
'medium': '84rpx',
'small': '72rpx',
'mini': '64rpx'
} [this.btnSize] || height
}
return height
}, },
// #ifndef APP-NVUE // #ifndef APP-NVUE
getBorderRadius() { getBorderRadius() {
......
...@@ -62,9 +62,8 @@ ...@@ -62,9 +62,8 @@
</view> </view>
</view> </view>
<view class="fui-calendar__btn-wrap" v-if="showBtn"> <view class="fui-calendar__btn-wrap" v-if="showBtn">
<view class="fui-calendar__btn" <view class="fui-calendar__btn" :class="{'fui-calendar__diaabled':btnDisabled}"
:class="{'fui-calendar__btn-color':!btnBackground,'fui-calendar__diaabled':btnDisabled}" :style="{background:btnBackground || primaryColor}">
:style="{background:btnBackground}">
<text class="fui-calendar__btn" <text class="fui-calendar__btn"
:class="{'fui-calendar__btn-text':true,'fui-calendar__btn-active':!btnDisabled}" :class="{'fui-calendar__btn-text':true,'fui-calendar__btn-active':!btnDisabled}"
:style="{color:btnColor}" @tap.stop="handleClick">{{btnText}}</text> :style="{color:btnColor}" @tap.stop="handleClick">{{btnText}}</text>
...@@ -168,11 +167,11 @@ ...@@ -168,11 +167,11 @@
//选中日期背景色 //选中日期背景色
activeBackground: { activeBackground: {
type: String, type: String,
default: '#465CFF' default: ''
}, },
rangeColor: { rangeColor: {
type: String, type: String,
default: '#465CFF' default: ''
}, },
rangeBackground: { rangeBackground: {
type: String, type: String,
...@@ -204,7 +203,7 @@ ...@@ -204,7 +203,7 @@
}, },
btnBackground: { btnBackground: {
type: String, type: String,
default: '#465CFF' default: ''
}, },
btnColor: { btnColor: {
type: String, type: String,
...@@ -244,6 +243,10 @@ ...@@ -244,6 +243,10 @@
// #ifndef APP-NVUE // #ifndef APP-NVUE
return '14.2857%' return '14.2857%'
// #endif // #endif
},
primaryColor() {
const app = uni && uni.$fui && uni.$fui.color;
return (app && app.primary) || '#465CFF';
} }
}, },
watch: { watch: {
...@@ -366,7 +369,7 @@ ...@@ -366,7 +369,7 @@
if (~values.indexOf(date)) { if (~values.indexOf(date)) {
color = this.activeColor color = this.activeColor
} else if (values[1] && this._isSection(date, values[0], values[1])) { } else if (values[1] && this._isSection(date, values[0], values[1])) {
color = this.rangeColor color = this.rangeColor || this.primaryColor
} }
} else { } else {
if (~values.indexOf(date)) { if (~values.indexOf(date)) {
...@@ -384,13 +387,13 @@ ...@@ -384,13 +387,13 @@
let type = this.type; let type = this.type;
if (type == 3) { if (type == 3) {
if (~values.indexOf(date)) { if (~values.indexOf(date)) {
background = this.activeBackground background = this.activeBackground || this.primaryColor
} else if (values[1] && this._isSection(date, values[0], values[1])) { } else if (values[1] && this._isSection(date, values[0], values[1])) {
background = this.rangeBackground background = this.rangeBackground
} }
} else { } else {
if (~values.indexOf(date)) { if (~values.indexOf(date)) {
background = this.activeBackground background = this.activeBackground || this.primaryColor
} }
} }
return background return background
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
<view class="fui-cascader__header-item" :id="`fui_cr_${idx}`" v-for="(item, idx) in selectedArr" <view class="fui-cascader__header-item" :id="`fui_cr_${idx}`" v-for="(item, idx) in selectedArr"
:key="idx" @tap.stop="swichTabs(idx)"> :key="idx" @tap.stop="swichTabs(idx)">
<text class="fui-cascader__header-text" <text class="fui-cascader__header-text"
:class="{'fui-cascader__hi-width':item.text.length>6,'fui-cascader__color':idx === current && !activeColor}" :class="{'fui-cascader__hi-width':item.text.length>6,'fui-cascader__color':idx === current && !getActiveColor}"
:style="{ color: idx === current ? activeColor : color, fontSize: size + 'rpx',fontWeight:idx === current?'bold':'normal' }">{{ item.text }}</text> :style="{ color: idx === current ? getActiveColor : color, fontSize: size + 'rpx',fontWeight:idx === current?'bold':'normal' }">{{ item.text }}</text>
<view class="fui-cascader__header-line" :class="{'fui-cascader__bg':!activeColor}" <view class="fui-cascader__header-line" :class="{'fui-cascader__bg':!getActiveColor}"
:style="{ background: activeColor }" v-if="idx === current && showLine"></view> :style="{ background: getActiveColor }" v-if="idx === current && showLine"></view>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
<view class="fui-cascader__cell" :id="`fui_c_${subi}`" v-for="(sub, subi) in item.data" <view class="fui-cascader__cell" :id="`fui_c_${subi}`" v-for="(sub, subi) in item.data"
:key="subi" @tap.stop="change(index, subi, sub)"> :key="subi" @tap.stop="change(index, subi, sub)">
<view class="fui-cascader__checkmark" <view class="fui-cascader__checkmark"
:class="{'fui-cascader__icon-border':!activeColor}" :class="{'fui-cascader__icon-border':!getActiveColor}"
:style="{borderBottomColor:checkMarkColor || activeColor,borderRightColor:checkMarkColor || activeColor}" :style="{borderBottomColor:checkMarkColor || getActiveColor,borderRightColor:checkMarkColor || getActiveColor}"
v-if="item.index === subi"></view> v-if="item.index === subi"></view>
<image :src="sub.src" v-if="sub.src" class="fui-cascader__img" <image :src="sub.src" v-if="sub.src" class="fui-cascader__img"
:style="{ width: imgWidth+'rpx', height: imgHeight+'rpx', borderRadius: radius+'rpx' }"> :style="{ width: imgWidth+'rpx', height: imgHeight+'rpx', borderRadius: radius+'rpx' }">
...@@ -105,18 +105,10 @@ ...@@ -105,18 +105,10 @@
default: '#181818' default: '#181818'
}, },
//选中颜色 //选中颜色
// #ifdef APP-NVUE
activeColor: {
type: String,
default: '#465CFF'
},
// #endif
// #ifndef APP-NVUE
activeColor: { activeColor: {
type: String, type: String,
default: '' default: ''
}, },
// #endif
showLine: { showLine: {
type: Boolean, type: Boolean,
default: true default: true
...@@ -159,6 +151,18 @@ ...@@ -159,6 +151,18 @@
default: '#181818' default: '#181818'
} }
}, },
computed: {
getActiveColor() {
let color = this.activeColor;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color;
}
},
data() { data() {
return { return {
current: 0, current: 0,
......
<template> <template>
<!-- #ifdef APP-PLUS || H5 || MP-ALIPAY || MP-TOUTIAO --> <!-- #ifdef APP-PLUS || H5 || MP-ALIPAY || MP-TOUTIAO|| MP-KUAISHOU || MP-JD || MP-360 || MP-LARK -->
<checkbox-group :name="name"> <checkbox-group :name="name">
<slot></slot> <slot></slot>
</checkbox-group> </checkbox-group>
<!-- #endif --> <!-- #endif -->
<!-- #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ || MP-KUAISHOU || MP-JD || MP-360 || MP-LARK --> <!-- #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ -->
<fui-form-field :name="name" :value="vals"> <fui-form-field :name="name" v-model="vals">
<slot></slot> <slot></slot>
</fui-form-field> </fui-form-field>
<!-- #endif --> <!-- #endif -->
...@@ -16,10 +16,11 @@ ...@@ -16,10 +16,11 @@
export default { export default {
name: "fui-checkbox-group", name: "fui-checkbox-group",
emits: ['change', 'input', 'update:modelValue'], emits: ['change', 'input', 'update:modelValue'],
// #ifndef VUE3
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
behaviors: ['wx://form-field-group'], behaviors: ['wx://form-field-group'],
// #endif // #endif
// #ifdef MP-BAIDU || MP-QQ || H5
behaviors: ['uni://form-field'],
// #endif // #endif
props: { props: {
name: { name: {
......
<template> <template>
<view class="fui-checkbox__input" <view class="fui-checkbox__input"
:class="{'fui-checkbox__disabled':disabled,'fui-checkbox__color':!color && val && !isCheckMark}" :class="{'fui-checkbox__disabled':disabled,'fui-checkbox__color':!getColor && val && !isCheckMark}"
:style="{backgroundColor:getBackgroundColor(val,isCheckMark),borderColor:getBorderColor(val,isCheckMark),zoom:isNvue?1:scaleRatio,transform:`scale(${isNvue?scaleRatio:1})`,borderRadius:borderRadius}" :style="{backgroundColor:getBackgroundColor(val,isCheckMark),borderColor:getBorderColor(val,isCheckMark),zoom:isNvue?1:scaleRatio,transform:`scale(${isNvue?scaleRatio:1})`,borderRadius:borderRadius}"
@tap.stop="checkboxChange"> @tap.stop="checkboxChange">
<view class="fui-check__mark" :style="{borderBottomColor:checkMarkColor,borderRightColor:checkMarkColor}" <view class="fui-check__mark" :style="{borderBottomColor:checkMarkColor,borderRightColor:checkMarkColor}"
v-if="val"></view> v-if="val"></view>
<checkbox class="fui-checkbox__hidden" style="opacity: 0;position: absolute;" :color="color" :disabled="disabled" :value="value" :checked="val"> <checkbox class="fui-checkbox__hidden" style="opacity: 0;position: absolute;" :color="getColor"
:disabled="disabled" :value="value" :checked="val">
</checkbox> </checkbox>
</view> </view>
</template> </template>
...@@ -35,27 +36,25 @@ ...@@ -35,27 +36,25 @@
//checkbox选中背景颜色 //checkbox选中背景颜色
color: { color: {
type: String, type: String,
// #ifdef APP-NVUE
default: '#465CFF'
// #endif
// #ifndef APP-NVUE
default: '' default: ''
// #endif
}, },
//checkbox未选中时边框颜色 //checkbox未选中时边框颜色
borderColor: { borderColor: {
type: String, type: String,
default: '#ccc' default: '#ccc'
}, },
// #ifdef APP-NVUE
borderRadius: { borderRadius: {
type: String, type: String,
// #ifdef APP-NVUE default: '40px'
default: '40rpx' },
// #endif // #endif
// #ifndef APP-NVUE // #ifndef APP-NVUE
borderRadius: {
type: String,
default: '50%' default: '50%'
// #endif
}, },
// #endif
//是否只展示对号,无边框背景 //是否只展示对号,无边框背景
isCheckMark: { isCheckMark: {
type: Boolean, type: Boolean,
...@@ -100,6 +99,18 @@ ...@@ -100,6 +99,18 @@
} }
} }
}, },
computed: {
getColor() {
let color = this.color;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color;
}
},
data() { data() {
let isNvue = false; let isNvue = false;
// #ifdef APP-NVUE // #ifdef APP-NVUE
...@@ -112,14 +123,14 @@ ...@@ -112,14 +123,14 @@
}, },
methods: { methods: {
getBackgroundColor(val, isCheckMark) { getBackgroundColor(val, isCheckMark) {
let color = val ? this.color : '#fff' let color = val ? this.getColor : '#fff'
if (isCheckMark) { if (isCheckMark) {
color = 'transparent' color = 'transparent'
} }
return color; return color;
}, },
getBorderColor(val, isCheckMark) { getBorderColor(val, isCheckMark) {
let color = val ? this.color : this.borderColor; let color = val ? this.getColor : this.borderColor;
if (isCheckMark) { if (isCheckMark) {
color = 'transparent' color = 'transparent'
} }
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<!-- #ifdef APP-VUE || H5 --> <!-- #ifdef APP-VUE || H5 -->
<canvas :start="percentage" :change:start="parse.init" :width="w" :change:width="parse.widthChange" <canvas :start="percentage" :change:start="parse.init" :width="w" :change:width="parse.widthChange"
:sw="strokeWidth" :change:sw="parse.widthChange" :data-width="w" :data-sw="strokeWidth" :data-lc="lineCap" :sw="strokeWidth" :change:sw="parse.widthChange" :data-width="w" :data-sw="strokeWidth" :data-lc="lineCap"
:data-size="size" :data-percent="percentage" :data-color="color" :data-show="show" :data-ds="defaultShow" :data-size="size" :data-percent="percentage" :data-color="color || primaryColor" :data-show="show" :data-ds="defaultShow"
:data-background="background" :data-foreground="foreground" :data-gradient="gradient" :data-sa="sAngle" :data-background="background" :data-foreground="foreground || primaryColor" :data-gradient="gradient" :data-sa="sAngle"
:data-ccw="counterclockwise" :data-speed="speed" :data-am="activeMode" :data-cid="circleId" :data-ccw="counterclockwise" :data-speed="speed" :data-am="activeMode" :data-cid="circleId"
:canvas-id="circleId" :class="[circleId]" :style="{width: w + 'px',height: w + 'px'}"></canvas> :canvas-id="circleId" :class="[circleId]" :style="{width: w + 'px',height: w + 'px'}"></canvas>
<!-- #endif --> <!-- #endif -->
...@@ -205,7 +205,7 @@ ...@@ -205,7 +205,7 @@
//圆环进度字体颜色 //圆环进度字体颜色
color: { color: {
type: String, type: String,
default: '#465CFF' default: ''
}, },
//是否显示进度文字 //是否显示进度文字
show: { show: {
...@@ -225,7 +225,7 @@ ...@@ -225,7 +225,7 @@
//默认前景颜色 //默认前景颜色
foreground: { foreground: {
type: String, type: String,
default: '#465CFF' default: ''
}, },
//进度条渐变颜色,结合foreground使用 //进度条渐变颜色,结合foreground使用
gradient: { gradient: {
...@@ -258,6 +258,12 @@ ...@@ -258,6 +258,12 @@
this.initWidth(val) this.initWidth(val)
} }
}, },
computed: {
primaryColor() {
const app = uni && uni.$fui && uni.$fui.color;
return (app && app.primary) || '#465CFF';
}
},
data() { data() {
// #ifndef MP-WEIXIN // #ifndef MP-WEIXIN
const circleId = `fui_cc_${Math.ceil(Math.random() * 10e5).toString(36)}` const circleId = `fui_cc_${Math.ceil(Math.random() * 10e5).toString(36)}`
......
...@@ -62,12 +62,12 @@ export default { ...@@ -62,12 +62,12 @@ export default {
sw = sw * 4 sw = sw * 4
// #endif // #endif
ctx.setLineWidth(sw); ctx.setLineWidth(sw);
let gradient = this.foreground; let gradient = this.foreground || this.primaryColor;
// #ifndef MP-KUAISHOU // #ifndef MP-KUAISHOU
if (this.gradient) { if (this.gradient) {
gradient = ctx.createLinearGradient(0, 0, Number(this.w), 0); gradient = ctx.createLinearGradient(0, 0, Number(this.w), 0);
gradient.addColorStop(0, this.gradient); gradient.addColorStop(0, this.gradient);
gradient.addColorStop(1, this.foreground); gradient.addColorStop(1, this.foreground || this.primaryColor);
} }
// #endif // #endif
ctx.setStrokeStyle(gradient); ctx.setStrokeStyle(gradient);
...@@ -82,7 +82,7 @@ export default { ...@@ -82,7 +82,7 @@ export default {
si = si * 4 si = si * 4
// #endif // #endif
ctx.setFontSize(si); ctx.setFontSize(si);
ctx.setFillStyle(this.color); ctx.setFillStyle(this.color || this.primaryColor);
ctx.setTextAlign('center'); ctx.setTextAlign('center');
ctx.setTextBaseline('middle'); ctx.setTextBaseline('middle');
let percent = `${this.counterclockwise ? 100 - start : start}%`; let percent = `${this.counterclockwise ? 100 - start : start}%`;
......
...@@ -78,7 +78,7 @@ export default { ...@@ -78,7 +78,7 @@ export default {
this.defaultShow && this.drawDefaultCircle(ctx) this.defaultShow && this.drawDefaultCircle(ctx)
ctx.setLineWidth(Number(this.strokeWidth)); ctx.setLineWidth(Number(this.strokeWidth));
ctx.beginPath() ctx.beginPath()
let gradient = this.foreground; let gradient = this.foreground || this.primaryColor;
// if (this.gradient) { // if (this.gradient) {
// gradient = ctx.createLinearGradient(0, 0, this.w, 0); // gradient = ctx.createLinearGradient(0, 0, this.w, 0);
// gradient.addColorStop(0, this.gradient); // gradient.addColorStop(0, this.gradient);
...@@ -92,7 +92,7 @@ export default { ...@@ -92,7 +92,7 @@ export default {
} }
if (this.show) { if (this.show) {
ctx.setFontSize(this.fontSize); ctx.setFontSize(this.fontSize);
ctx.setFillStyle(this.color); ctx.setFillStyle(this.color || this.primaryColor);
ctx.setTextAlign('center'); ctx.setTextAlign('center');
ctx.setTextBaseline('middle'); ctx.setTextBaseline('middle');
let percent = `${this.counterclockwise ? 100 - start : start}%`; let percent = `${this.counterclockwise ? 100 - start : start}%`;
......
...@@ -103,21 +103,6 @@ ...@@ -103,21 +103,6 @@
watch: { watch: {
open(val) { open(val) {
this.isOpen = val this.isOpen = val
},
isOpen(val) {
this.$nextTick(async () => {
let parent = this.$parent;
let parentName = parent.$options.name;
while (parentName !== 'PageBody') {
if (parentName === 'fui-collapse-item') {
await parent.init()
}
parent = parent.$parent;
if (!parent) return false;
parentName = parent.$options.name;
}
})
} }
}, },
updated(e) { updated(e) {
...@@ -150,14 +135,12 @@ ...@@ -150,14 +135,12 @@
}, },
methods: { methods: {
init() { init() {
const promise = []
// #ifndef APP-NVUE // #ifndef APP-NVUE
promise.push(this.getCollapseHeight()) this.getCollapseHeight()
// #endif // #endif
// #ifdef APP-NVUE // #ifdef APP-NVUE
promise.push(this.getNvueHeight()) this.getNvueHeight()
// #endif // #endif
return Promise.all(promise)
}, },
uninstall() { uninstall() {
if (this.collapse) { if (this.collapse) {
...@@ -181,7 +164,6 @@ ...@@ -181,7 +164,6 @@
} }
}, },
getCollapseHeight(index = 0) { getCollapseHeight(index = 0) {
return new Promise((resolve) => {
uni.createSelectorQuery() uni.createSelectorQuery()
// #ifndef MP-ALIPAY // #ifndef MP-ALIPAY
.in(this) .in(this)
...@@ -203,14 +185,10 @@ ...@@ -203,14 +185,10 @@
this.height = data.height this.height = data.height
// #endif // #endif
this.isHeight = true this.isHeight = true
resolve(this.height)
}) })
.exec() .exec()
})
}, },
getNvueHeight() { getNvueHeight() {
return new Promise((resolve) => {
const result = dom.getComponentRect(this.$refs['fui_collapse__el'], option => { const result = dom.getComponentRect(this.$refs['fui_collapse__el'], option => {
if (option && option.result && option.size) { if (option && option.result && option.size) {
// #ifdef APP-NVUE // #ifdef APP-NVUE
...@@ -220,11 +198,8 @@ ...@@ -220,11 +198,8 @@
this.height = option.size.height this.height = option.size.height
// #endif // #endif
this.isHeight = true this.isHeight = true
resolve(this.height)
} }
}) })
})
}, },
getCollapse(name = 'fui-collapse') { getCollapse(name = 'fui-collapse') {
let parent = this.$parent; let parent = this.$parent;
......
/*
组件属性全局配置文件。优先级:全局配置文件props < 直接设置组件props
目前支持配置的组件:fui-button、fui-icon、fui-text、fui-input、fui-form-item、fui-list-cell
*/
// 主色(V1.9.8+),仅Nvue端以及无法使用css变量控制颜色的组件使用【保持与fui-theme中一致】
const color = {
primary: '#465CFF',
success: '#09BE4F',
warning: '#FFB703',
danger: '#FF2B2B',
purple: '#6831FF',
link: '#465CFF'
}
//全局方法(V1.9.8+)
const app = {
toast: function(text, icon = 'none') {
text && uni.showToast({
title: text,
icon: icon,
duration: 2000
})
},
modal: function(title, content, callback, showCancel, confirmColor, confirmText) {
uni.showModal({
title: title,
content: content,
showCancel: showCancel || false,
// #ifndef MP-TOUTIAO
cancelColor: "#7F7F7F",
confirmColor: confirmColor || color.primary,
// #endif
confirmText: confirmText || "确定",
success(res) {
if (res.confirm) {
callback && callback(true)
} else {
callback && callback(false)
}
},
fail(err) {
console.log(err)
}
})
},
href(url, isMain) {
if (isMain) {
uni.switchTab({
url: url
})
} else {
uni.navigateTo({
url: url
});
}
}
}
const fuiConfig = {
//组件名称,小驼峰命名
//如fui-button写成fuiButton
fuiButton: {
//组件属性值
height: '96rpx',
size: 32,
radius: '16rpx'
},
fuiIcon: {
size: 64,
unit: 'rpx',
//V1.9.8+
color: ''
},
fuiText: {
size: 32,
unit: 'rpx',
//仅Nvue有效,black 默认颜色,V1.9.8+
color: ''
},
fuiInput: {
labelSize: 32,
size: 32
},
fuiFormItem: {
labelSize: 32,
labelWidth: 160,
labelRight: 30,
labelWeight: 400,
labelAlign: 'left',
asteriskPosition: 'left'
},
// V1.9.8+
fuiListCell: {
padding: ['32rpx', '32rpx'],
arrowColor: '',
//仅Nvue有效
borderColor: '',
bottomLeft: 32
},
color,
...app
}
export default fuiConfig
<template> <template>
<view class="fui-countdown__verify" :class="{'fui-cdv__disabled':status>1}" <view class="fui-countdown__verify" :class="{'fui-cdv__disabled':status>1}"
:style="{ width: width+'rpx', height: height+'rpx', marginLeft: marginLeft+'rpx',marginRight:marginRight+'rpx', borderRadius: radius+'rpx', background: background,borderColor:!borderColor || borderColor==='true'?background:borderColor }"> :style="{ width: width+'rpx', height: height+'rpx', marginLeft: marginLeft+'rpx',marginRight:marginRight+'rpx', borderRadius: radius+'rpx', background: background,borderColor:!getBorderColor || getBorderColor===true?background:getBorderColor }">
<text :style="{fontSize: size + 'rpx',lineHeight:size + 'rpx', color: color}" class="fui-countdown__verify-text" <text :style="{fontSize: size + 'rpx',lineHeight:size + 'rpx', color: getColor}"
:class="{'fui-cdv__color':!color}">{{ showText }}</text> class="fui-countdown__verify-text" :class="{'fui-cdv__color':!getColor}">{{ showText }}</text>
<view class="fui-countdown__verify-main fui-countdown__verify-active" :style="{borderRadius: radius+'rpx'}" <view class="fui-countdown__verify-main fui-countdown__verify-active" :style="{borderRadius: radius+'rpx'}"
@tap.stop="sendCode" v-if="status===1"></view> @tap.stop="sendCode" v-if="status===1"></view>
<!-- #ifndef APP-NVUE --> <!-- #ifndef APP-NVUE -->
<view class="fui-countdown__verify-line" :class="{'fui-cdv__border-color':!borderColor}" <view class="fui-countdown__verify-line" :class="{'fui-cdv__border-color':!getBorderColor}"
:style="{borderColor: borderColor, borderRadius: (radius * 2)+'rpx'}"> :style="{borderColor: getBorderColor, borderRadius: (radius * 2)+'rpx'}">
</view> </view>
<!-- #endif --> <!-- #endif -->
</view> </view>
...@@ -67,42 +67,48 @@ ...@@ -67,42 +67,48 @@
default: 24 default: 24
}, },
//字体颜色 //字体颜色
// #ifdef APP-NVUE
color: {
type: String,
default: '#465CFF'
},
// #endif
// #ifndef APP-NVUE
color: { color: {
type: String, type: String,
default: '' default: ''
}, },
// #endif
//背景色 //背景色
background: { background: {
type: String, type: String,
default: 'transparent' default: 'transparent'
}, },
//边框颜色 //边框颜色
// #ifdef APP-NVUE
borderColor: {
type: String,
default: '#465CFF'
},
// #endif
// #ifndef APP-NVUE
borderColor: { borderColor: {
type: String, type: String,
default: '' default: ''
}, },
// #endif
//自定义参数 //自定义参数
param: { param: {
type: [Number, String], type: [Number, String],
default: 0 default: 0
} }
}, },
computed: {
getColor() {
let color = this.color;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color
},
getBorderColor() {
let color = this.borderColor;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color
}
},
data() { data() {
return { return {
showText: '', showText: '',
......
...@@ -2,25 +2,25 @@ ...@@ -2,25 +2,25 @@
<view class="fui-data__tag-wrap" :style="{marginBottom:'-'+gap+'rpx'}"> <view class="fui-data__tag-wrap" :style="{marginBottom:'-'+gap+'rpx'}">
<!-- #ifndef APP-NVUE --> <!-- #ifndef APP-NVUE -->
<view class="fui-data__tag-item" :class="{'fui-data__tag-disable':item.disable}" <view class="fui-data__tag-item" :class="{'fui-data__tag-disable':item.disable}"
:style="{width:width?width+'rpx':'auto',height:height?height+'rpx':'auto',paddingTop:padding[0] || 0,paddingRight:padding[1] || 0,paddingBottom:padding[2] || padding[0] || 0,paddingLeft:padding[3] || padding[1] || 0,borderRadius:radius+'rpx',marginRight:gap+'rpx',marginBottom:gap+'rpx',background:item.selected?activeBgColor:background,borderColor:item.selected?borderColor:(defaultBorderColor || background)}" :style="{width:width?width+'rpx':'auto',height:height?height+'rpx':'auto',paddingTop:padding[0] || 0,paddingRight:padding[1] || 0,paddingBottom:padding[2] || padding[0] || 0,paddingLeft:padding[3] || padding[1] || 0,borderRadius:radius+'rpx',marginRight:gap+'rpx',marginBottom:gap+'rpx',background:item.selected?activeBgColor:background,borderColor:item.selected?(borderColor || primaryColor):(defaultBorderColor || background)}"
v-for="(item,index) in dataList" :key="index"> v-for="(item,index) in dataList" :key="index">
<view class="fui-data__tag-inner" @tap.stop="handleClick(index)"> <view class="fui-data__tag-inner" @tap.stop="handleClick(index)">
<text class="fui-dt__icon" :style="{color:markColor,fontSize:markSize+'rpx',lineHeight:markSize+'rpx'}" <text class="fui-dt__icon" :style="{color:markColor || primaryColor,fontSize:markSize+'rpx',lineHeight:markSize+'rpx'}"
v-if="mark && item.selected">{{icon}}</text> v-if="mark && item.selected">{{icon}}</text>
</view> </view>
<text class="fui-data__tag-text" <text class="fui-data__tag-text"
:style="{fontSize:size+'rpx',color:item.selected?activeColor:color}">{{item.text}}</text> :style="{fontSize:size+'rpx',color:item.selected?(activeColor || primaryColor):color}">{{item.text}}</text>
</view> </view>
<!-- #endif --> <!-- #endif -->
<!-- #ifdef APP-NVUE --> <!-- #ifdef APP-NVUE -->
<view class="fui-data__tag-item" :class="{'fui-data__tag-disable':item.disable}" <view class="fui-data__tag-item" :class="{'fui-data__tag-disable':item.disable}"
:style="{width:width?width+'rpx':'auto',height:height?height+'rpx':'auto',paddingTop:padding[0] || 0,paddingRight:padding[1] || 0,paddingBottom:padding[2] || padding[0] || 0,paddingLeft:padding[3] || padding[1] || 0,borderRadius:radius+'rpx',marginRight:gap+'rpx',marginBottom:gap+'rpx',background:item.selected?activeBgColor:background,borderColor:item.selected?borderColor:defaultBorderColor || background}" :style="{width:width?width+'rpx':'auto',height:height?height+'rpx':'auto',paddingTop:padding[0] || 0,paddingRight:padding[1] || 0,paddingBottom:padding[2] || padding[0] || 0,paddingLeft:padding[3] || padding[1] || 0,borderRadius:radius+'rpx',marginRight:gap+'rpx',marginBottom:gap+'rpx',background:item.selected?activeBgColor:background,borderColor:item.selected?(borderColor || primaryColor):defaultBorderColor || background}"
v-for="(item,index) in dataList" :key="index" @tap.stop="handleClick(index)"> v-for="(item,index) in dataList" :key="index" @tap.stop="handleClick(index)">
<text class="fui-dt__icon" :style="{color:markColor,fontSize:markSize+'rpx',lineHeight:markSize+'rpx'}" <text class="fui-dt__icon" :style="{color:markColor || primaryColor,fontSize:markSize+'rpx',lineHeight:markSize+'rpx'}"
v-if="mark && item.selected">{{icon}}</text> v-if="mark && item.selected">{{icon}}</text>
<text class="fui-data__tag-text" <text class="fui-data__tag-text"
:style="{fontSize:size+'rpx',lineHeight:size+'rpx',color:item.selected?activeColor:color}">{{item.text}}</text> :style="{fontSize:size+'rpx',lineHeight:size+'rpx',color:item.selected?(activeColor || primaryColor):color}">{{item.text}}</text>
</view> </view>
<!-- #endif --> <!-- #endif -->
</view> </view>
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
}, },
activeColor: { activeColor: {
type: String, type: String,
default: '#465CFF' default: ''
}, },
background: { background: {
type: String, type: String,
...@@ -120,13 +120,13 @@ ...@@ -120,13 +120,13 @@
default: '#fff' default: '#fff'
}, },
//默认边框颜色 //默认边框颜色
defaultBorderColor:{ defaultBorderColor: {
type: String, type: String,
default: '' default: ''
}, },
borderColor: { borderColor: {
type: String, type: String,
default: '#465CFF' default: ''
}, },
//设为true时,圆角值不建议设过大 //设为true时,圆角值不建议设过大
mark: { mark: {
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
}, },
markColor: { markColor: {
type: String, type: String,
default: '#465CFF' default: ''
} }
}, },
watch: { watch: {
...@@ -158,6 +158,12 @@ ...@@ -158,6 +158,12 @@
created() { created() {
this.initData(this.options) this.initData(this.options)
}, },
computed: {
primaryColor() {
const app = uni && uni.$fui && uni.$fui.color;
return (app && app.primary) || '#465CFF';
}
},
data() { data() {
return { return {
icon: '\ue600', icon: '\ue600',
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<text class="fui-date__picker-title" <text class="fui-date__picker-title"
:class="[theme==='dark'?'fui-dpk__title-color_dark':'fui-dpk__title-color']" :class="[theme==='dark'?'fui-dpk__title-color_dark':'fui-dpk__title-color']"
:style="titleStyl">{{title}}</text> :style="titleStyl">{{title}}</text>
<text class="fui-dpk__btn-sure fui-dpk__sure-color" :style="confrimStyl" <text class="fui-dpk__btn-sure" :class="{'fui-dpk__sure-color':!confirmColor}" :style="confrimStyl"
@tap.stop="btnConfirm">确定</text> @tap.stop="btnConfirm">确定</text>
</view> </view>
<view class="fui-dpk__range-wrap" v-if="range"> <view class="fui-dpk__range-wrap" v-if="range">
...@@ -421,8 +421,15 @@ ...@@ -421,8 +421,15 @@
}, },
confrimStyl() { confrimStyl() {
let styles = `font-size:${this.btnSize}rpx;` let styles = `font-size:${this.btnSize}rpx;`
if (this.confirmColor) { let color = this.confirmColor;
styles += `color:${this.confirmColor};` // #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
if (color) {
styles += `color:${color};`
} }
return styles return styles
}, },
...@@ -459,15 +466,29 @@ ...@@ -459,15 +466,29 @@
}, },
startStyl() { startStyl() {
let style = '' let style = ''
if (this.isActive == 1 && this.rangeBackground) { let color = this.rangeBackground;
style = `background:${this.rangeBackground};` // #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
if (this.isActive == 1 && color) {
style = `background:${color};`
} }
return style return style
}, },
endStyl() { endStyl() {
let style = '' let style = ''
if (this.isActive == 2 && this.rangeBackground) { let color = this.rangeBackground;
style = `background:${this.rangeBackground};` // #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
if (this.isActive == 2 && color) {
style = `background:${color};`
} }
return style return style
} }
...@@ -486,18 +507,24 @@ ...@@ -486,18 +507,24 @@
secondRange(val) { secondRange(val) {
this.getSeconds() this.getSeconds()
}, },
// #ifdef APP-NVUE
isShow: { isShow: {
handler(newVal) { handler(newVal) {
if (newVal) { if (newVal) {
// #ifndef APP-NVUE
this.isInitShow = true
// #endif
// #ifdef APP-NVUE
this.openPicker(); this.openPicker();
// #endif
} else { } else {
// #ifdef APP-NVUE
this.closePicker(); this.closePicker();
// #endif
} }
}, },
immediate: true immediate: true
}, },
// #endif
show(val) { show(val) {
this.isShow = val; this.isShow = val;
} }
...@@ -528,7 +555,8 @@ ...@@ -528,7 +555,8 @@
isShow: false, isShow: false,
isActive: 1, isActive: 1,
startDate: {}, startDate: {},
endDate: {} endDate: {},
isInitShow: false
}; };
}, },
methods: { methods: {
...@@ -826,7 +854,7 @@ ...@@ -826,7 +854,7 @@
[hi, mi, si], [hi, mi, si],
[mi, si] [mi, si]
][type - 1] ][type - 1]
}, 50) }, 200)
}) })
}, },
getResult() { getResult() {
...@@ -949,17 +977,19 @@ ...@@ -949,17 +977,19 @@
//判断选择结果 //判断选择结果
let start = this.startDate.result; let start = this.startDate.result;
let end = this.endDate.result; let end = this.endDate.result;
if (!start || !end) { if (!start && !end) {
let msg = !start ? this.start : this.end this.startDate = this.getResult()
this.isActive = 2
uni.showToast({ uni.showToast({
title: `请选择${msg}`, title: `请选择${this.end}`,
icon: 'none' icon: 'none'
}) })
if (start && !end) { return
this.isActive = 2 } else if (start && !end) {
this.endDate = this.getResult()
end = this.endDate.result;
} }
return; if (!this.compareDate(start, end)) {
} else if (!this.compareDate(start, end)) {
uni.showToast({ uni.showToast({
title: `${this.end}不能小于${this.start}`, title: `${this.end}不能小于${this.start}`,
icon: 'none' icon: 'none'
...@@ -975,6 +1005,7 @@ ...@@ -975,6 +1005,7 @@
}, 80) }, 80)
}, },
pickerChange(e) { pickerChange(e) {
if (!this.isInitShow) return;
let value = e.detail.value; let value = e.detail.value;
let type = Number(this.type) let type = Number(this.type)
if (type > 1 && type < 6) { if (type > 1 && type < 6) {
...@@ -995,7 +1026,7 @@ ...@@ -995,7 +1026,7 @@
} else { } else {
this.endDate = this.getResult() this.endDate = this.getResult()
} }
}, 35) }, 50)
} }
this.isEnd = true; this.isEnd = true;
}, },
...@@ -1242,10 +1273,6 @@ ...@@ -1242,10 +1273,6 @@
.fui-dpk__range-active { .fui-dpk__range-active {
color: #fff; color: #fff;
/* #ifdef APP-NVUE */
background: #465CFF;
/* #endif */
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
background: var(--fui-color-primary, #465CFF); background: var(--fui-color-primary, #465CFF);
/* #endif */ /* #endif */
...@@ -1316,16 +1343,12 @@ ...@@ -1316,16 +1343,12 @@
color: #D1D1D1; color: #D1D1D1;
} }
.fui-dpk__sure-color {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
.fui-dpk__sure-color {
color: var(--fui-color-primary, #465CFF) !important; color: var(--fui-color-primary, #465CFF) !important;
/* #endif */
/* #ifdef APP-NVUE */
color: #465CFF;
/* #endif */
} }
/* #endif */
.fui-date__picker-view { .fui-date__picker-view {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
width: 100%; width: 100%;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
// #ifdef APP-NVUE // #ifdef APP-NVUE
const animation = uni.requireNativePlugin('animation'); const animation = uni.requireNativePlugin('animation');
// #endif // #endif
const primaryColor = (uni && uni.$fui && uni.$fui.color && uni.$fui.color.primary) || '#465CFF';
export default { export default {
name: 'fui-dialog', name: 'fui-dialog',
emits: ['click', 'close'], emits: ['click', 'close'],
...@@ -51,7 +52,7 @@ ...@@ -51,7 +52,7 @@
text: '取消' text: '取消'
}, { }, {
text: '确定', text: '确定',
color: '#465CFF' color: primaryColor
}] }]
} }
}, },
......
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
</view> </view>
<view class="fui-dk__button-wrap"> <view class="fui-dk__button-wrap">
<view class="fui-dk__button" <view class="fui-dk__button"
:class="{'fui-dk__button-color':!background,'fui-dk__btn-disabled':disabled}" :class="{'fui-dk__button-color':!getBgColor,'fui-dk__btn-disabled':disabled}"
:style="{background:background}"> :style="{background:getBgColor}">
<text class="fui-dk__button-text" <text class="fui-dk__button-text"
:style="{color:color,fontSize:size+'rpx',fontWeight:fontWeight}">{{text}}</text> :style="{color:color,fontSize:size+'rpx',fontWeight:fontWeight}">{{text}}</text>
<view class="fui-dk__button-ck" :class="{'fui-dk__highlight':!disabled}" @tap.stop="confirm"> <view class="fui-dk__button-ck" :class="{'fui-dk__highlight':!disabled}" @tap.stop="confirm">
...@@ -58,18 +58,10 @@ ...@@ -58,18 +58,10 @@
type: String, type: String,
default: '确定' default: '确定'
}, },
// #ifdef APP-NVUE
background: {
type: String,
default: '#465CFF'
},
// #endif
// #ifndef APP-NVUE
background: { background: {
type: String, type: String,
default: '' default: ''
}, },
// #endif
color: { color: {
type: String, type: String,
default: '#fff' default: '#fff'
...@@ -136,6 +128,18 @@ ...@@ -136,6 +128,18 @@
this.initData() this.initData()
} }
}, },
computed: {
getBgColor() {
let color = this.background;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color;
}
},
data() { data() {
return { return {
iphoneX: false, iphoneX: false,
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<view class="fui-digital__roller-column" <view class="fui-digital__roller-column"
:style="{transform:`translateY(-${(keys[index] || 0) * rollHeight}px)`}"> :style="{transform:`translateY(-${(keys[index] || 0) * rollHeight}px)`}">
<text class="fui-digital__roller-item" v-for="(item,idx) in items" :key="idx" <text class="fui-digital__roller-item" v-for="(item,idx) in items" :key="idx"
:style="{color:color,fontSize:size+'rpx',lineHeight:size+'rpx',fontWeight:fontWeight,height:rollHeight+'px'}">{{item}}</text> :style="{color:getColor,fontSize:size+'rpx',lineHeight:size+'rpx',fontWeight:fontWeight,height:rollHeight+'px'}">{{item}}</text>
</view> </view>
<!-- #endif --> <!-- #endif -->
</view> </view>
...@@ -28,18 +28,10 @@ ...@@ -28,18 +28,10 @@
type: [Number, String], type: [Number, String],
default: '' default: ''
}, },
// #ifdef APP-NVUE
color: {
type: String,
default: '#465CFF'
},
// #endif
// #ifndef APP-NVUE
color: { color: {
type: String, type: String,
default: '' default: ''
}, },
// #endif
size: { size: {
type: [Number, String], type: [Number, String],
default: 32 default: 32
...@@ -68,6 +60,16 @@ ...@@ -68,6 +60,16 @@
styles += `width:${this.width}rpx;` styles += `width:${this.width}rpx;`
} }
return styles return styles
},
getColor() {
let color = this.color;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color;
} }
}, },
watch: { watch: {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</view> </view>
<image :draggable="false" :style="{width:width-(padding*2)+'px',height:height-(padding*2)+'px'}" <image :draggable="false" :style="{width:width-(padding*2)+'px',height:height-(padding*2)+'px'}"
:src="src" class="fui-drag__item-img" :class="{'fui-drag__item-mr':type==2}" :src="src" class="fui-drag__item-img" :class="{'fui-drag__item-mr':type==2}"
v-if="src && src!==true && src!=='true' && type==1" > v-if="src && src!==true && src!=='true' && type==1">
</image> </image>
<view class="fui-drag__item-icon" @tap.stop="handleDel" :class="{'fui-drag__item-ab':type==1}" <view class="fui-drag__item-icon" @tap.stop="handleDel" :class="{'fui-drag__item-ab':type==1}"
v-if="type==1 && isDel"> v-if="type==1 && isDel">
...@@ -89,7 +89,9 @@ ...@@ -89,7 +89,9 @@
this.size = styles.size || 30 this.size = styles.size || 30
this.color = styles.color || '#181818' this.color = styles.color || '#181818'
this.isDel = styles.isDel || false this.isDel = styles.isDel || false
this.delColor = styles.delColor || '#FF2B2B' const app = uni && uni.$fui && uni.$fui.color;
const dangerColor = (app && app.danger) || '#FF2B2B';
this.delColor = styles.delColor || dangerColor
this.slideColor = styles.slideColor || '#B2B2B2' this.slideColor = styles.slideColor || '#B2B2B2'
}, },
handleDel() { handleDel() {
...@@ -106,7 +108,7 @@ ...@@ -106,7 +108,7 @@
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
box-sizing: border-box; box-sizing: border-box;
transform: translate3d(0,0,0); transform: translate3d(0, 0, 0);
backface-visibility: hidden; backface-visibility: hidden;
/* #endif */ /* #endif */
justify-content: center; justify-content: center;
...@@ -185,7 +187,7 @@ ...@@ -185,7 +187,7 @@
display: block; display: block;
pointer-events: none; pointer-events: none;
flex-shrink: 0; flex-shrink: 0;
transform: translate3d(0,0,0); transform: translate3d(0, 0, 0);
backface-visibility: hidden; backface-visibility: hidden;
/* #endif */ /* #endif */
} }
......
...@@ -5,7 +5,7 @@ function isPC() { ...@@ -5,7 +5,7 @@ function isPC() {
var userAgentInfo = navigator.userAgent; var userAgentInfo = navigator.userAgent;
var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
var flag = true; var flag = true;
for (var v = 0; v < Agents.length - 1; v++) { for (var v = 0; v< Agents.length - 1; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) { if (userAgentInfo.indexOf(Agents[v]) > 0) {
flag = false; flag = false;
break; break;
......
...@@ -59,7 +59,8 @@ ...@@ -59,7 +59,8 @@
// #endif // #endif
return { return {
isNvue: isNvue, isNvue: isNvue,
isShow: false isShow: false,
width: 0
} }
}, },
// #ifdef APP-NVUE // #ifdef APP-NVUE
...@@ -76,7 +77,37 @@ ...@@ -76,7 +77,37 @@
} }
}, },
// #endif // #endif
mounted() {
setTimeout(() => {
this._getSize((width) => {
this.width = width
})
}, 100)
},
methods: { methods: {
_getSize(callback) {
// #ifndef APP-NVUE
uni.createSelectorQuery()
// #ifndef MP-ALIPAY
.in(this)
// #endif
.select('.fui-drawer__popup')
.boundingClientRect()
.exec(ret => {
if (ret) {
callback && callback(ret[0].width || 0)
}
})
// #endif
// #ifdef APP-NVUE
dom.getComponentRect(this.$refs['fui_dwr_ani'], (ret) => {
const size = ret.size
if (size) {
callback && callback(size.width)
}
})
// #endif
},
handleClose(e) { handleClose(e) {
if (!this.maskClosable) return; if (!this.maskClosable) return;
this.$emit('close', {}); this.$emit('close', {});
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
:class="{'fui-ddl__reverse':isReverse,'fui-ddl__item-line':splitLine && itemList.length-1!==index}" :class="{'fui-ddl__reverse':isReverse,'fui-ddl__item-line':splitLine && itemList.length-1!==index}"
v-for="(model,index) in itemList" :key="index" @tap.stop.prevent="itemClick($event,index)"> v-for="(model,index) in itemList" :key="index" @tap.stop.prevent="itemClick($event,index)">
<view class="fui-ddl__checkbox" <view class="fui-ddl__checkbox"
:class="{'fui-is__checkmark':isCheckMark,'fui-ddl__checkbox-color':(!checkboxColor || checkboxColor=='true') && model.checked && !isCheckMark}" :class="{'fui-is__checkmark':isCheckMark,'fui-ddl__checkbox-color':(!checkboxColor || checkboxColor===true) && model.checked && !isCheckMark}"
:style="{background:model.checked && !isCheckMark ?checkboxColor:'transparent',borderColor:model.checked && !isCheckMark ?checkboxColor:borderColor}" :style="{background:model.checked && !isCheckMark ?getChkColor:'transparent',borderColor:model.checked && !isCheckMark ?getChkColor:borderColor}"
v-if="isCheckbox"> v-if="isCheckbox">
<view class="fui-ddl__checkmark" <view class="fui-ddl__checkmark"
:style="{borderBottomColor:checkmarkColor,borderRightColor:checkmarkColor}" :style="{borderBottomColor:checkmarkColor,borderRightColor:checkmarkColor}"
...@@ -22,8 +22,7 @@ ...@@ -22,8 +22,7 @@
<view class="fui-ddl__icon-box" <view class="fui-ddl__icon-box"
:class="{'fui-ddl__icon-ml':!isReverse && isCheckbox,'fui-ddl__icon-mr':isReverse}" :class="{'fui-ddl__icon-ml':!isReverse && isCheckbox,'fui-ddl__icon-mr':isReverse}"
:style="{width:iconWidth+'rpx',height:iconWidth+'rpx'}" v-if="model.src"> :style="{width:iconWidth+'rpx',height:iconWidth+'rpx'}" v-if="model.src">
<image :src="model.src" <image :src="model.src" :style="{width:iconWidth+'rpx',height:iconWidth+'rpx'}"></image>
:style="{width:iconWidth+'rpx',height:iconWidth+'rpx'}"></image>
</view> </view>
<text class="fui-ddl__item-text" <text class="fui-ddl__item-text"
:class="{'fui-ddl__text-pl':!isReverse && (isCheckbox || model.src),'fui-ddl__text-pr':isReverse && (isCheckbox || model.src)}" :class="{'fui-ddl__text-pl':!isReverse && (isCheckbox || model.src),'fui-ddl__text-pr':isReverse && (isCheckbox || model.src)}"
...@@ -80,12 +79,7 @@ ...@@ -80,12 +79,7 @@
}, },
checkboxColor: { checkboxColor: {
type: String, type: String,
// #ifdef APP-NVUE
default: '#465CFF'
// #endif
// #ifndef APP-NVUE
default: '' default: ''
// #endif
}, },
borderColor: { borderColor: {
type: String, type: String,
...@@ -154,6 +148,16 @@ ...@@ -154,6 +148,16 @@
styles += `width:${width}rpx;` styles += `width:${width}rpx;`
} }
return styles return styles
},
getChkColor() {
let color = this.checkboxColor;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color;
} }
}, },
data() { data() {
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
:class="{'fui-ddm__reverse':isReverse,'fui-ddm__item-line':splitLine && itemList.length-1!==index}" :class="{'fui-ddm__reverse':isReverse,'fui-ddm__item-line':splitLine && itemList.length-1!==index}"
v-for="(model,index) in itemList" :key="index" @tap.stop="itemClick(index)"> v-for="(model,index) in itemList" :key="index" @tap.stop="itemClick(index)">
<view class="fui-ddm__checkbox" <view class="fui-ddm__checkbox"
:class="{'fui-is__checkmark':isCheckMark,'fui-ddm__checkbox-color':(!checkboxColor || checkboxColor=='true') && model.checked && !isCheckMark}" :class="{'fui-is__checkmark':isCheckMark,'fui-ddm__checkbox-color':(!checkboxColor || checkboxColor===true) && model.checked && !isCheckMark}"
:style="{background:model.checked && !isCheckMark ?checkboxColor:'transparent',borderColor:model.checked && !isCheckMark ?checkboxColor:borderColor}" :style="{background:model.checked && !isCheckMark ?getChkColor:'transparent',borderColor:model.checked && !isCheckMark ?getChkColor:borderColor}"
v-if="isCheckbox"> v-if="isCheckbox">
<view class="fui-ddm__checkmark" <view class="fui-ddm__checkmark"
:style="{borderBottomColor:checkmarkColor,borderRightColor:checkmarkColor}" :style="{borderBottomColor:checkmarkColor,borderRightColor:checkmarkColor}"
...@@ -89,12 +89,7 @@ ...@@ -89,12 +89,7 @@
//选择框选中后颜色 //选择框选中后颜色
checkboxColor: { checkboxColor: {
type: String, type: String,
// #ifdef APP-NVUE
default: '#465CFF'
// #endif
// #ifndef APP-NVUE
default: '' default: ''
// #endif
}, },
//选择框未选中时边框颜色 //选择框未选中时边框颜色
borderColor: { borderColor: {
...@@ -208,6 +203,16 @@ ...@@ -208,6 +203,16 @@
} }
// #endif // #endif
return styles return styles
},
getChkColor() {
let color = this.checkboxColor;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color;
} }
}, },
created() { created() {
......
...@@ -29,15 +29,18 @@ ...@@ -29,15 +29,18 @@
type: String, type: String,
default: '' default: ''
}, },
// #ifdef APP-NVUE
color: { color: {
type: String, type: String,
// #ifdef APP-NVUE
default: '#333333' default: '#333333'
},
// #endif // #endif
// #ifndef APP-NVUE // #ifndef APP-NVUE
color: {
type: String,
default: '' default: ''
// #endif
}, },
// #endif
size: { size: {
type: [Number, String], type: [Number, String],
default: 32 default: 32
...@@ -46,15 +49,18 @@ ...@@ -46,15 +49,18 @@
type: String, type: String,
default: '' default: ''
}, },
// #ifdef APP-NVUE
descrColor: { descrColor: {
type: String, type: String,
// #ifdef APP-NVUE
default: '#B2B2B2' default: '#B2B2B2'
},
// #endif // #endif
// #ifndef APP-NVUE // #ifndef APP-NVUE
descrColor: {
type: String,
default: '' default: ''
// #endif
}, },
// #endif
descrSize: { descrSize: {
type: [Number, String], type: [Number, String],
default: 24 default: 24
......
// #ifdef APP-NVUE
const animation = uni.requireNativePlugin('animation');
export default {
data() {
return {
startX: 0,
startY: 0,
lastLeft: 0,
lastTop: 0,
isMove: false
}
},
created() {
this.refFab = null;
this.loop = null
},
mounted() {
this.$nextTick(() => {
setTimeout(() => {
this.refFab = this.getEl(this.$refs['fui_fab_move_ref'])
}, 50)
})
},
methods: {
getEl(el) {
return el.ref || el[0].ref;
},
_aniMove(x, y) {
if (!this.refFab || !this.isDrag) return
animation.transition(this.refFab, {
styles: {
transform: `translate(${x}px,${y}px)`
},
duration: 0,
timingFunction: 'linear',
needLayout: false,
delay: 0
}, () => {
if (Math.abs(x) > 0.1 || Math.abs(y) > 0.1) {
this.isMove = true;
}
});
},
touchstart(e) {
if (!this.isDrag) return;
var touch = e.touches || e.changedTouches
this.startX = touch[0].screenX
this.startY = touch[0].screenY
},
touchmove(e) {
if (!this.isDrag) return;
var touch = e.touches || e.changedTouches
let pageX = touch[0].screenX,
pageY = touch[0].screenY;
var left = pageX - this.startX + this.lastLeft;
left = left < -this.eLeft ? -this.eLeft : left;
left = left > this.maxWidth ? this.maxWidth : left;
this.startX = pageX
var top = pageY - this.startY + this.lastTop;
top = top < -this.eTop ? -this.eTop : top;
top = top > this.maxHeight ? this.maxHeight : top;
this.startY = pageY
this.lastLeft = left
this.lastTop = top
this._aniMove(left, top)
},
touchend(e) {
clearTimeout(this.loop)
this.loop = setTimeout(() => {
this.isMove = false
}, 50)
}
}
}
// #endif
// #ifndef APP-NVUE
export default {}
// #endif
var movable = {
width: 100,
height: 100,
disabled: false,
left: 0,
top: 0
}
function isPC() {
if (typeof navigator !== 'object') return false;
var userAgentInfo = navigator.userAgent;
var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
var flag = true;
for (var v = 0; v< Agents.length - 1; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) {
flag = false;
break;
}
}
return flag;
}
var isH5 = false
if (typeof window === 'object') isH5 = true
function setInitValue(dataset, isChange) {
movable.width = +dataset.width
movable.height = +dataset.height
movable.top = +dataset.top
movable.left = +dataset.left
//H5获取bool值为undefined
movable.disabled = (+dataset.disabled) == 1 ? true : false
}
function touchstart(e, ins) {
if (movable.disabled) return;
var state = e.instance.getState()
var touch = e.touches[0] || e.changedTouches[0];
if (isH5 && isPC()) {
touch = e;
}
var dataset = e.instance.getDataset()
state.startX = touch.clientX
state.startY = touch.clientY
setInitValue(dataset)
}
function styleChange(left, top, ins) {
if (!ins) return;
var mview = ins.selectComponent('.fui-fab__btn-wrap');
if (!mview) return;
mview.setStyle({
transform: 'translate3d(' + left + 'px,' + top + 'px,0)'
})
}
function touchmove(e, ins, event) {
if (movable.disabled) return;
if (e.preventDefault) {
// 阻止页面滚动
e.preventDefault()
}
var state = {}
var touch = {}
if (isH5 && isPC()) {
touch = e;
state = event.instance.getState()
} else {
touch = e.touches[0] || e.changedTouches[0]
state = e.instance.getState()
}
var pageX = touch.clientX;
var pageY = touch.clientY;
var left = pageX - state.startX + (state.lastLeft || 0);
left = left < -movable.left ? -movable.left : left;
left = left > movable.width ? movable.width : left;
state.startX = pageX
var top = pageY - state.startY + (state.lastTop || 0);
top = top < -movable.top ? -movable.top : top;
top = top > movable.height ? movable.height : top;
state.startY = pageY
state.lastLeft = left
state.lastTop = top
styleChange(left, top, ins)
}
var _movable = false;
function mousedown(e, ins) {
if (!isH5 || !isPC()) return
touchstart(e, ins)
_movable = true
window.onmousemove = function(event) {
if (!isH5 || !isPC() || !_movable) return
touchmove(event, ins, e)
}
window.onmouseup = function(event) {
if (!isH5 || !isPC() || !_movable) return
_movable = false
}
}
module.exports = {
touchstart: touchstart,
touchmove: touchmove,
mousedown: mousedown
}
// #ifndef APP-PLUS || MP-WEIXIN || H5
export default {
data() {
return {
startX: 0,
startY: 0,
lastLeft: 0,
lastTop: 0,
transform: ''
}
},
methods: {
touchstart(e) {
if (!this.isDrag) return;
const touch = e.touches || e.changedTouches
this.startX = touch[0].clientX
this.startY = touch[0].clientY
},
touchmove(e) {
if (!this.isDrag) return;
const touch = e.touches || e.changedTouches
let pageX = touch[0].clientX,
pageY = touch[0].clientY;
var left = pageX - this.startX + this.lastLeft;
left = left < -this.eLeft ? -this.eLeft : left;
left = left > this.maxWidth ? this.maxWidth : left;
this.startX = pageX
var top = pageY - this.startY + this.lastTop;
top = top < -this.eTop ? -this.eTop : top;
top = top > this.maxHeight ? this.maxHeight : top;
this.startY = pageY
this.lastLeft = left
this.lastTop = top
this.transform = `translate3d(${left}px,${top}px,0)`
}
}
}
// #endif
// #ifdef APP-PLUS|| MP-WEIXIN || H5
export default {}
// #endif
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
:class="{'fui-link__color':!item.color}" hover-class="fui-link-hover" hover-stop-propagation :class="{'fui-link__color':!item.color}" hover-class="fui-link-hover" hover-stop-propagation
:open-type="item.openType || 'navigate'" :url="item.url" :delta="item.delta"><text :open-type="item.openType || 'navigate'" :url="item.url" :delta="item.delta"><text
class="fui-link__text" :class="{'fui-link__text-border':index===navigate.length-1}" class="fui-link__text" :class="{'fui-link__text-border':index===navigate.length-1}"
:style="{color:item.color || '#465CFF',fontSize:(item.size || 28)+'rpx',borderColor:borderColor,lineHeight:(item.size || 28)+'rpx'}">{{item.text}}</text> :style="{color:item.color || linkColor,fontSize:(item.size || 28)+'rpx',borderColor:borderColor,lineHeight:(item.size || 28)+'rpx'}">{{item.text}}</text>
</navigator> </navigator>
</view> </view>
<view class="fui-footer__text" :class="{'fui-as__safe-weex':iphoneX && safeArea}" :style="{color:color,fontSize:size+'rpx'}"> <view class="fui-footer__text" :class="{'fui-as__safe-weex':iphoneX && safeArea}" :style="{color:color,fontSize:size+'rpx'}">
...@@ -63,6 +63,12 @@ ...@@ -63,6 +63,12 @@
default: true default: true
} }
}, },
computed: {
linkColor() {
const app = uni && uni.$fui && uni.$fui.color;
return (app && app.link) || '#465CFF';
}
},
data() { data() {
return { return {
iphoneX: false iphoneX: false
...@@ -82,9 +88,8 @@ ...@@ -82,9 +88,8 @@
let iphonex = false; let iphonex = false;
let models = ['iphonex', 'iphonexr', 'iphonexsmax', 'iphone11', 'iphone11pro', 'iphone11promax', let models = ['iphonex', 'iphonexr', 'iphonexsmax', 'iphone11', 'iphone11pro', 'iphone11promax',
'iphone12', 'iphone12mini', 'iphone12pro', 'iphone12promax', 'iphone13', 'iphone13mini', 'iphone12', 'iphone12mini', 'iphone12pro', 'iphone12promax', 'iphone13', 'iphone13mini',
'iphone13pro', 'iphone13promax', 'iphone14', 'iphone14mini', 'iphone14plus', 'iphone13pro', 'iphone13promax', 'iphone14', 'iphone14mini',
'iphone14pro', 'iphone14promax', 'iphone15', 'iphone15mini', 'iphone15plus', 'iphone14pro', 'iphone14promax', 'iphone15'
'iphone15pro', 'iphone15promax'
] ]
const model = res.model.replace(/\s/g, "").toLowerCase() const model = res.model.replace(/\s/g, "").toLowerCase()
const newModel = model.split('<')[0] const newModel = model.split('<')[0]
...@@ -139,7 +144,8 @@ ...@@ -139,7 +144,8 @@
} }
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
.fui-link__color text { .fui-link__color text,
.fui-link__color {
color: var(--fui-color-link, #465CFF) !important; color: var(--fui-color-link, #465CFF) !important;
} }
......
...@@ -7,15 +7,22 @@ ...@@ -7,15 +7,22 @@
<script> <script>
//此组件只为form表单提交传递数据使用,暂时用于微信小程序/百度小程序/QQ小程序 //此组件只为form表单提交传递数据使用,暂时用于微信小程序/百度小程序/QQ小程序
export default { export default {
emits: ['input', 'update:modelValue'],
name: "fui-form-field", name: "fui-form-field",
// #ifndef VUE3
behaviors: ['uni://form-field'], behaviors: ['uni://form-field'],
// #endif
props: { props: {
//是否为隐藏域 //是否为隐藏域
hidden: { hidden: {
type: Boolean, type: Boolean,
default: false default: false
},
value: {
type: [Number, String, Array],
default: ''
},
modelValue: {
type: [Number, String, Array],
default: ''
} }
} }
} }
......
...@@ -4,15 +4,15 @@ ...@@ -4,15 +4,15 @@
@tap="handleClick"> @tap="handleClick">
<!-- #ifdef APP-NVUE --> <!-- #ifdef APP-NVUE -->
<view class="fui-form__asterisk" :style="{left:getAkPosi}" v-if="asterisk"> <view class="fui-form__asterisk" :style="{left:getAkPosi}" v-if="asterisk">
<text :style="{color:asteriskColor || akColor || '#FF2B2B'}">*</text> <text :style="{color:asteriskColor || akColor || dangerColor}">*</text>
</view> </view>
<!-- #endif --> <!-- #endif -->
<!-- #ifndef APP-NVUE --> <!-- #ifndef APP-NVUE -->
<view class="fui-form__asterisk" v-if="asterisk" <view class="fui-form__asterisk" v-if="asterisk"
:style="{color:asteriskColor || akColor || '#FF2B2B',left:getAkPosi}">*</view> :style="{color:asteriskColor || akColor || dangerColor,left:getAkPosi}">*</view>
<!-- #endif --> <!-- #endif -->
<text class="fui-form__item-sizing" <text class="fui-form__item-sizing"
:style="{width:getLabelWidth,fontSize:getLabelSize,color:labelColor || lColor || '#333',paddingRight:getLabelRight,textAlign:getLabelAlign}" :style="{width:getLabelWidth,fontSize:getLabelSize,color:labelColor || lColor || '#333',paddingRight:getLabelRight,textAlign:getLabelAlign,fontWeight:getLabelWeight}"
v-if="label">{{label}}</text> v-if="label">{{label}}</text>
<view class="fui-form__item-content"> <view class="fui-form__item-content">
<slot></slot> <slot></slot>
...@@ -77,6 +77,10 @@ ...@@ -77,6 +77,10 @@
type: String, type: String,
default: '' default: ''
}, },
labelWeight: {
type: [Number, String],
default: 0
},
//是否显示必填的红色星号 //是否显示必填的红色星号
asterisk: { asterisk: {
type: Boolean, type: Boolean,
...@@ -152,6 +156,10 @@ ...@@ -152,6 +156,10 @@
const labelAlign = (uni.$fui && uni.$fui.fuiFormItem && uni.$fui.fuiFormItem.labelAlign) || 'left' const labelAlign = (uni.$fui && uni.$fui.fuiFormItem && uni.$fui.fuiFormItem.labelAlign) || 'left'
return this.labelAlign || this.lAlign || labelAlign return this.labelAlign || this.lAlign || labelAlign
}, },
getLabelWeight() {
const global = (uni.$fui && uni.$fui.fuiFormItem && uni.$fui.fuiFormItem.labelWeight) || 400
return this.labelWeight || this.lWeight || global
},
getAkPosi() { getAkPosi() {
const akPosi = (uni.$fui && uni.$fui.fuiFormItem && uni.$fui.fuiFormItem.asteriskPosition) || 'left' const akPosi = (uni.$fui && uni.$fui.fuiFormItem && uni.$fui.fuiFormItem.asteriskPosition) || 'left'
const position = this.asteriskPosition || this.akPosi || akPosi const position = this.asteriskPosition || this.akPosi || akPosi
...@@ -160,6 +168,10 @@ ...@@ -160,6 +168,10 @@
const pr = this.padding[1] const pr = this.padding[1]
const pdr = pr ? pr.replace('rpx', '').replace('px', '') : 0; const pdr = pr ? pr.replace('rpx', '').replace('px', '') : 0;
return position === 'right' ? `${Number(lWidth) + Number(pdr || 0) - Number(lRight || 0)}rpx` : '12rpx' return position === 'right' ? `${Number(lWidth) + Number(pdr || 0) - Number(lRight || 0)}rpx` : '12rpx'
},
dangerColor() {
const app = uni && uni.$fui && uni.$fui.color;
return (app && app.danger) || '#FF2B2B';
} }
}, },
data() { data() {
...@@ -168,6 +180,7 @@ ...@@ -168,6 +180,7 @@
lColor: '', lColor: '',
lWidth: 0, lWidth: 0,
lAlign: '', lAlign: '',
lWeight: 0,
akColor: '', akColor: '',
akPosi: '' akPosi: ''
} }
...@@ -182,6 +195,7 @@ ...@@ -182,6 +195,7 @@
this.lSize = this.form.labelSize; this.lSize = this.form.labelSize;
this.lColor = this.form.labelColor; this.lColor = this.form.labelColor;
this.lWidth = this.form.labelWidth; this.lWidth = this.form.labelWidth;
this.lWeight = this.form.labelWeight;
this.lAlign = this.form.labelAlign; this.lAlign = this.form.labelAlign;
this.akColor = this.form.asteriskColor; this.akColor = this.form.asteriskColor;
this.akPosi = this.form.asteriskPosition; this.akPosi = this.form.asteriskPosition;
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
:style="{paddingTop:padding[0] || 0,paddingRight:padding[1] || 0,paddingBottom:padding[2] || padding[0] || 0,paddingLeft:padding[3] || padding[1] || 0}"> :style="{paddingTop:padding[0] || 0,paddingRight:padding[1] || 0,paddingBottom:padding[2] || padding[0] || 0,paddingLeft:padding[3] || padding[1] || 0}">
<slot></slot> <slot></slot>
<view class="fui-form__msg-wrap" <view class="fui-form__msg-wrap"
:style="{top:top+'px',left:left+'rpx',right:right+'rpx',background:background,borderRadius:radius+'rpx'}" :style="{top:top+'px',left:left+'rpx',right:right+'rpx',background:getBgColor,borderRadius:radius+'rpx'}"
v-if="show" :class="{'fui-form__msg-bg':!background,'fui-form__msg-show':errorMsg}"><text v-if="show" :class="{'fui-form__msg-bg':!getBgColor,'fui-form__msg-show':errorMsg}"><text
class="fui-form__text" :style="{fontSize:size+'rpx',color:color}">{{errorMsg}}</text></view> class="fui-form__text" :style="{fontSize:size+'rpx',color:color}">{{errorMsg}}</text></view>
<view class="fui-form__mask" v-if="disabled"></view> <view class="fui-form__mask" v-if="disabled"></view>
</view> </view>
...@@ -53,12 +53,7 @@ ...@@ -53,12 +53,7 @@
//错误提示框背景色 //错误提示框背景色
background: { background: {
type: String, type: String,
// #ifdef APP-NVUE
default: '#FF2B2B'
// #endif
// #ifndef APP-NVUE
default: '' default: ''
// #endif
}, },
//错误提示字体大小 //错误提示字体大小
size: { size: {
...@@ -87,7 +82,7 @@ ...@@ -87,7 +82,7 @@
}, },
labelColor: { labelColor: {
type: String, type: String,
default: '#333' default: ''
}, },
//form-item label宽度,单位rpx 默认使用全局设置值 //form-item label宽度,单位rpx 默认使用全局设置值
labelWidth: { labelWidth: {
...@@ -95,17 +90,21 @@ ...@@ -95,17 +90,21 @@
default: 0 default: 0
}, },
//label 对齐方式:left,right //label 对齐方式:left,right
labelAlign:{ labelAlign: {
type: String, type: String,
default: 'left' default: ''
},
labelWeight: {
type: [Number, String],
default: 0
}, },
// form-item 必填项星号颜色 // form-item 必填项星号颜色
asteriskColor: { asteriskColor: {
type: String, type: String,
default: '#FF2B2B' default: ''
}, },
//left,right //left,right
asteriskPosition:{ asteriskPosition: {
type: String, type: String,
default: '' default: ''
} }
...@@ -115,6 +114,18 @@ ...@@ -115,6 +114,18 @@
form: this form: this
} }
}, },
computed: {
getBgColor() {
let color = this.background;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.danger) || '#FF2B2B';
}
// #endif
return color;
}
},
data() { data() {
return { return {
errorMsg: '', errorMsg: '',
......
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
<text class="fui-gallery__index">{{active+1}}/{{imgUrls.length}}</text> <text class="fui-gallery__index">{{active+1}}/{{imgUrls.length}}</text>
</view> </view>
<view class="fui-gallery__descr-wrap" :class="{'fui-gallery__weex-safe':iphoneX && safeArea}" v-if="descr"> <view class="fui-gallery__descr-wrap" :class="{'fui-gallery__weex-safe':iphoneX && safeArea}" v-if="descr">
<text class="fui-gallery__descr" :class="{'fui-gallery__text-ellipsis':ellipsis}" <text class="fui-gallery__descr" :class="{'fui-gallery__text-ellipsis':ellipsis}">{{descr}}</text>
v-if="descr">{{descr}}</text>
</view> </view>
</view> </view>
</template> </template>
...@@ -73,7 +72,6 @@ ...@@ -73,7 +72,6 @@
this.defActive = Number(this.current); this.defActive = Number(this.current);
this.active = this.defActive; this.active = this.defActive;
this.initData(this.urls) this.initData(this.urls)
this.getDescr(this.active)
}, },
data() { data() {
let isNvue = false; let isNvue = false;
...@@ -101,6 +99,11 @@ ...@@ -101,6 +99,11 @@
}) })
} }
this.imgUrls = vals; this.imgUrls = vals;
this.$nextTick(() => {
setTimeout(() => {
this.getDescr(this.active)
}, 10)
})
} }
}, },
change(e) { change(e) {
...@@ -123,7 +126,8 @@ ...@@ -123,7 +126,8 @@
let models = ['iphonex', 'iphonexr', 'iphonexsmax', 'iphone11', 'iphone11pro', 'iphone11promax', let models = ['iphonex', 'iphonexr', 'iphonexsmax', 'iphone11', 'iphone11pro', 'iphone11promax',
'iphone12', 'iphone12mini', 'iphone12pro', 'iphone12promax', 'iphone13', 'iphone13mini', 'iphone12', 'iphone12mini', 'iphone12pro', 'iphone12promax', 'iphone13', 'iphone13mini',
'iphone13pro', 'iphone13promax', 'iphone14', 'iphone14mini', 'iphone13pro', 'iphone13promax', 'iphone14', 'iphone14mini',
'iphone14pro', 'iphone14promax' 'iphone14pro', 'iphone14promax', 'iphone15', 'iphone15mini',
'iphone15pro', 'iphone15promax'
] ]
const model = res.model.replace(/\s/g, "").toLowerCase() const model = res.model.replace(/\s/g, "").toLowerCase()
const newModel = model.split('<')[0] const newModel = model.split('<')[0]
......
// #ifdef APP-NVUE
const BindingX = uni.requireNativePlugin('bindingx');
export default {
methods: {
getEl(el) {
return this.$refs[el].ref;
},
nvueScrollHandler(e) {
const anchor = this.getEl('fui_scroller_view')
const element = this.getEl('fui_hor_indicator')
const scrollLeft = e.contentOffset.x
const contentWidth = e.contentSize.width
if (this.scroll && element) {
const barAllMoveWidth = this.bgWidth - this.blockWidth
const platform = uni.getSystemInfoSync().platform
const actionNum = platform.toLowerCase() === 'ios' ? 2 : 1
const expression = `(x / ${actionNum}) / ${contentWidth - this.width} * ${barAllMoveWidth}`
BindingX.bind({
anchor,
eventType: 'scroll',
props: [{
element,
property: 'transform.translateX',
expression
}]
})
}
if (scrollLeft + this.width === contentWidth) {
this.scrollEvent('right')
} else if (scrollLeft === 0) {
this.scrollEvent('left')
}
}
}
}
// #endif
// #ifndef APP-NVUE
export default {}
// #endif
<template>
<view class="fui-horizontal__scroll" :style="{marginTop:marginTop+'rpx',marginBottom:marginBottom+'rpx'}"
ref="fui_horizontal__scroll">
<!-- #ifdef APP-VUE || MP-WEIXIN || H5-->
<scroll-view scroll-x :upper-threshold="0" :lower-threshold="0" :data-width="width" :data-bgwidth="bgWidth"
:data-blockwidth="blockWidth" @scroll="handler.scroll" @scrolltoupper="handler.scrolltoupper"
@scrolltolower="handler.scrolltolower" class="fui-hor__scroll-view">
<view class="fui-hor__scroll-wrap">
<slot></slot>
</view>
</scroll-view>
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<scroller class="fui-hor__scroll-view" ref="fui_scroller_view" scroll-direction="horizontal"
:show-scrollbar="false" :offset-accuracy="2" @scroll="nvueScrollHandler">
<view class="fui-hor__scroll-wrap">
<slot></slot>
</view>
</scroller>
<!-- #endif -->
<!-- #ifndef APP-PLUS || MP-WEIXIN || H5-->
<scroll-view scroll-x :upper-threshold="0" :lower-threshold="0" class="fui-hor__scroll-view"
@scroll="scrollHandler" @scrolltoupper="scrolltoupper" @scrolltolower="scrolltolower">
<view class="fui-hor__scroll-wrap">
<slot></slot>
</view>
</scroll-view>
<!-- #endif -->
<view class="fui-hor__scrollbar-wrap" :style="{marginTop:scrollGap+'rpx'}" v-if="scroll">
<view class="fui-hor__scrollbar" :class="{'fui-hor__scroll-radius':scrollCap==='round'}"
:style="{height:blockHeight+'px',width:bgWidth+'px',background:background}">
<view class="fui-hor__scroll-indicator"
:class="{'fui-hor__scroll-radius':scrollCap==='round','fui-hor__scroll-bg':!scrollBarColor}"
:style="getStyles" ref="fui_hor_indicator"></view>
</view>
</view>
</view>
</template>
<!-- #ifdef APP-VUE || MP-WEIXIN || H5-->
<script src="./index.wxs" module="handler" lang="wxs"></script>
<!-- #endif -->
<script>
// #ifdef APP-NVUE
const dom = uni.requireNativePlugin('dom');
// #endif
import bindingx from './bindingx.js'
import mpjs from './mpjs.js'
export default {
name: "fui-horizontal-scroll",
mixins: [mpjs, bindingx],
emits: ['scrolltoupper', 'scrolltolower'],
props: {
marginTop: {
type: [String, Number],
default: 0
},
marginBottom: {
type: [String, Number],
default: 0
},
// 是否显示滚动条
scroll: {
type: Boolean,
default: true
},
// 滚动条区域宽度/长度
scrollWidth: {
type: [String, Number],
default: 96
},
// 滚动条的宽度
scrollBarWidth: {
type: [String, Number],
default: 32
},
// 滚动区域/滚动条高度
scrollHeight: {
type: [String, Number],
default: 8
},
//滚动条两端样式,可选值为 square、round
scrollCap: {
type: String,
default: 'round'
},
scrollBarColor: {
type: String,
default: ''
},
background: {
type: String,
default: '#EEEEEE'
},
//自定义滚动条距离上方内容间距
scrollGap: {
type: [String, Number],
default: 24
}
},
data() {
return {
width: 0,
//滚动条背景长度
bgWidth: 0,
//滚动条滑块长度
blockWidth: 0,
blockHeight: 0,
transform: ''
};
},
created() {
this.bgWidth = this.getPx(this.scrollWidth || 96)
this.blockWidth = this.getPx(this.scrollBarWidth || 32)
this.blockHeight = this.getPx(this.scrollHeight || 8)
},
mounted() {
this.$nextTick(() => {
this.init()
})
},
watch: {
scrollWidth(val) {
this.bgWidth = this.getPx(val || 96)
},
scrollBarWidth(val) {
this.blockWidth = this.getPx(this.scrollBarWidth || 32)
},
scrollHeight(val) {
this.blockHeight = this.getPx(this.scrollHeight || 8)
}
},
computed: {
getStyles() {
let style = `height:${this.blockHeight}px;width:${this.blockWidth}px;`
let color = this.scrollBarColor;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
if (color && color !== true) {
style += `background:${color};`
}
// #ifndef APP-PLUS || MP-WEIXIN
style += `transform:${this.transform}`
// #endif
return style
}
},
methods: {
//如果初始化有误,可调用此方法重新初始化
init() {
setTimeout(() => {
this._getSize()
}, 80);
},
getPx(rpx) {
let px = Math.floor(uni.upx2px(Number(rpx)));
px = px % 2 === 0 ? px : px + 1
return px;
},
scrollEvent(edge) {
const event = edge === 'left' ? 'scrolltoupper' : 'scrolltolower'
this.$emit(event)
},
_getSize() {
// #ifndef APP-NVUE
uni.createSelectorQuery()
// #ifndef MP-ALIPAY
.in(this)
// #endif
.select('.fui-horizontal__scroll')
.boundingClientRect()
.exec(ret => {
if (ret) {
this.width = ret[0].width || 0
}
})
// #endif
// #ifdef APP-NVUE
dom.getComponentRect(this.$refs['fui_horizontal__scroll'], (ret) => {
const size = ret.size
if (size) {
this.width = size.width
}
})
// #endif
}
}
}
</script>
<style scoped>
/* #ifndef APP-NVUE */
::-webkit-scrollbar {
width: 0 !important;
height: 0 !important;
color: transparent !important;
display: none;
}
/* #endif */
.fui-horizontal__scroll,
.fui-hor__scroll-view,
.fui-hor__scroll-wrap {
/* #ifndef APP-NVUE */
display: flex;
flex-shrink: 0;
/* #endif */
flex-direction: row;
}
.fui-horizontal__scroll {
flex-direction: column;
align-items: stretch;
/* #ifndef APP-NVUE */
align-content: flex-start;
/* #endif */
}
.fui-hor__scrollbar-wrap {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
justify-content: center;
}
.fui-hor__scrollbar {
position: relative;
overflow: hidden;
/* #ifndef APP-NVUE */
transform: translateZ(0);
/* #endif */
}
.fui-hor__scroll-radius {
border-radius: 100px;
}
.fui-hor__scroll-indicator {
position: absolute;
left: 0;
top: 0;
}
/* #ifndef APP-NVUE */
.fui-hor__scroll-bg {
background-color: var(--fui-color-primary, #465CFF) !important;
}
/* #endif */
</style>
function scroll(event, ownerInstance) {
var detail = event.detail
var scrollWidth = detail.scrollWidth
var scrollLeft = detail.scrollLeft
var dataset = event.currentTarget.dataset
var width = dataset.width || 0
var scrollBarWidth = dataset.bgwidth || 0
var blockWidth = dataset.blockwidth || 0
var x = scrollLeft / (scrollWidth - width) * (scrollBarWidth - blockWidth)
setBarStyle(ownerInstance, x)
}
function scrolltolower(event, ownerInstance) {
ownerInstance.callMethod('scrollEvent', 'right')
var dataset = event.currentTarget.dataset
var scrollBarWidth = dataset.bgwidth || 0
var blockWidth = dataset.blockwidth || 0
setBarStyle(ownerInstance, scrollBarWidth - blockWidth)
}
function scrolltoupper(event, ownerInstance) {
ownerInstance.callMethod('scrollEvent', 'left')
setBarStyle(ownerInstance, 0)
}
function setBarStyle(ownerInstance, x) {
var block = ownerInstance.selectComponent('.fui-hor__scroll-indicator')
block && block.setStyle({
transform: 'translate3d(' + x + 'px,0,0)'
})
}
module.exports = {
scroll: scroll,
scrolltolower: scrolltolower,
scrolltoupper: scrolltoupper
}
// #ifndef APP-PLUS || MP-WEIXIN || H5
export default {
methods: {
scrollHandler(event) {
const detail = event.detail
const scrollWidth = detail.scrollWidth
const scrollLeft = detail.scrollLeft
const width = this.width
const scrollBarWidth = this.bgWidth
const blockWidth = this.blockWidth
const x = scrollLeft / (scrollWidth - width) * (scrollBarWidth - blockWidth)
this.transform = `translate3d(${x}px,0,0)`
},
scrolltoupper(event) {
this.scrollEvent('left')
this.transform = 'translate3d(0,0,0)'
},
scrolltolower(event) {
this.scrollEvent('right')
const x = this.bgWidth - this.blockWidth
this.transform = `translate3d(${x}px,0,0)`
}
}
}
// #endif
// #ifdef APP-PLUS|| MP-WEIXIN || H5
export default {}
// #endif
<template> <template>
<!-- #ifndef APP-NVUE --> <!-- #ifndef APP-NVUE -->
<text :style="{ color: color, fontSize: getSize, fontWeight: fontWeight}" class="fui-icon" <text :style="{ color:getColor, fontSize: getSize, fontWeight: fontWeight}" class="fui-icon"
:class="[!color && !primary?'fui-icon__color':'',primary && !color?'fui-icon__active-color':'',disabled?'fui-icon__not-allowed':'',customPrefix,customPrefix?name:'']" :class="[!getColor && !primary?'fui-icon__color':'',primary && (!color || color===true)?'fui-icon__active-color':'',disabled?'fui-icon__not-allowed':'',customPrefix,customPrefix?name:'']"
@click="handleClick">{{ icons[name] || '' }}</text> @click="handleClick">{{ icons[name] || '' }}</text>
<!-- #endif --> <!-- #endif -->
<!-- #ifdef APP-NVUE --> <!-- #ifdef APP-NVUE -->
<text :style="{ color: color, fontSize: getSize,lineHeight:getSize, fontWeight: fontWeight}" class="fui-icon" <text
:class="[customPrefix]" @click="handleClick">{{ customPrefix?name:icons[name] }}</text> :style="{ color: primary && (!color || color===true)?primaryColor:getColor, fontSize: getSize,lineHeight:getSize, fontWeight: fontWeight}"
class="fui-icon" :class="[customPrefix]" @click="handleClick">{{ customPrefix?name:icons[name] }}</text>
<!-- #endif --> <!-- #endif -->
</template> </template>
...@@ -43,18 +44,10 @@ ...@@ -43,18 +44,10 @@
type: String, type: String,
default: '' default: ''
}, },
// #ifdef APP-NVUE
color: {
type: String,
default: '#333333'
},
// #endif
// #ifndef APP-NVUE
color: { color: {
type: String, type: String,
default: '' default: ''
}, },
// #endif
//字重 //字重
fontWeight: { fontWeight: {
type: [Number, String], type: [Number, String],
...@@ -73,7 +66,7 @@ ...@@ -73,7 +66,7 @@
type: String, type: String,
default: '' default: ''
}, },
//是否显示为主色调,color为空时有效。nvue不支持【内部使用】 //是否显示为主色调,color为空时有效。【内部使用】
primary: { primary: {
type: Boolean, type: Boolean,
default: false default: false
...@@ -84,6 +77,21 @@ ...@@ -84,6 +77,21 @@
const size = (uni.$fui && uni.$fui.fuiIcon && uni.$fui.fuiIcon.size) || 64 const size = (uni.$fui && uni.$fui.fuiIcon && uni.$fui.fuiIcon.size) || 64
const unit = (uni.$fui && uni.$fui.fuiIcon && uni.$fui.fuiIcon.unit) || 'rpx' const unit = (uni.$fui && uni.$fui.fuiIcon && uni.$fui.fuiIcon.unit) || 'rpx'
return (this.size || size) + (this.unit || unit) return (this.size || size) + (this.unit || unit)
},
primaryColor() {
const app = uni && uni.$fui && uni.$fui.color;
return (app && app.primary) || '#465CFF';
},
getColor() {
const app = uni && uni.$fui && uni.$fui.fuiIcon;
let color = this.color || (app && app.color)
// #ifdef APP-NVUE
if (!color || color === true) {
color = '#333333'
}
// #endif
return color;
} }
}, },
data() { data() {
......
...@@ -3,7 +3,7 @@ function isPC() { ...@@ -3,7 +3,7 @@ function isPC() {
var userAgentInfo = navigator.userAgent; var userAgentInfo = navigator.userAgent;
var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
var flag = true; var flag = true;
for (var v = 0; v < Agents.length - 1; v++) { for (var v = 0; v< Agents.length - 1; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) { if (userAgentInfo.indexOf(Agents[v]) > 0) {
flag = false; flag = false;
break; break;
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
<view class="fui-index__list-item" :class="{'fui-il__between':subRight}" @tap="onClick"> <view class="fui-index__list-item" :class="{'fui-il__between':subRight}" @tap="onClick">
<view class="fui-index__list-left"> <view class="fui-index__list-left">
<view class="fui-il__checkbox" <view class="fui-il__checkbox"
:class="{'fui-il__checkbox-color':(!selectedColor || selectedColor=='true') && model.checked}" :class="{'fui-il__checkbox-color':(!selectedColor || selectedColor === true) && model.checked}"
:style="{background:model.checked?selectedColor:'#fff',borderColor:model.checked?selectedColor:borderColor}" :style="{background:model.checked?getSelectedColor:'#fff',borderColor:model.checked?getSelectedColor:borderColor}"
v-if="isSelect"> v-if="isSelect">
<view class="fui-il__checkmark" v-if="model.checked"></view> <view class="fui-il__checkmark" v-if="model.checked"></view>
</view> </view>
<view class="fui-il__img-box" v-if="isSrc"> <view class="fui-il__img-box" v-if="isSrc">
<fLazyload v-if="model.src" :src="model.src" class="fui-index__list-img" width="72" height="72" mode="widthFix"></fLazyload> <image v-if="model.src" :src="model.src" class="fui-index__list-img" mode="widthFix"></image>
</view> </view>
<text class="fui-index__list-main">{{model.text || ''}}</text> <text class="fui-index__list-main">{{model.text || ''}}</text>
</view> </view>
...@@ -18,13 +18,9 @@ ...@@ -18,13 +18,9 @@
</template> </template>
<script> <script>
import fLazyload from '../fui-lazyload/fui-lazyload.vue'
//此组件为索引列表item项,若不满足要求可自行调整样式 //此组件为索引列表item项,若不满足要求可自行调整样式
export default { export default {
name: 'f-index-list-item', name: 'f-index-list-item',
components: {
fLazyload
},
props: { props: {
model: { model: {
type: Object, type: Object,
...@@ -39,12 +35,7 @@ ...@@ -39,12 +35,7 @@
}, },
selectedColor: { selectedColor: {
type: String, type: String,
// #ifdef APP-NVUE
default: '#465CFF'
// #endif
// #ifndef APP-NVUE
default: '' default: ''
// #endif
}, },
//checkbox未选中时边框颜色 //checkbox未选中时边框颜色
borderColor: { borderColor: {
...@@ -74,8 +65,18 @@ ...@@ -74,8 +65,18 @@
default: 0 default: 0
} }
}, },
data() { computed: {
return {} getSelectedColor() {
let color = this.selectedColor;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color;
}
}, },
methods: { methods: {
onClick() { onClick() {
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
<scroll-view class="fui-index__list-sv" scroll-y :scroll-into-view="scrollViewId"> <scroll-view class="fui-index__list-sv" scroll-y :scroll-into-view="scrollViewId">
<slot></slot> <slot></slot>
<view :id="'fui_il_letter_'+idx" v-for="(list, idx) in lists" :key="list.key"> <view :id="'fui_il_letter_'+idx" v-for="(list, idx) in lists" :key="list.key">
<!-- #endif -->
<!-- #ifndef APP-NVUE -->
<view class="fui-index__list-letter" :class="{'fui-il__key-bg':!background}" <view class="fui-index__list-letter" :class="{'fui-il__key-bg':!background}"
:style="{background:background}"> :style="{background:background}">
<text class="fui-il__letter-text" <text class="fui-il__letter-text"
...@@ -99,7 +97,7 @@ ...@@ -99,7 +97,7 @@
<view class="fui-letter__item" v-for="(item, i) in lists" :key="i"> <view class="fui-letter__item" v-for="(item, i) in lists" :key="i">
<!-- @tap="letterTap(i)" --> <!-- @tap="letterTap(i)" -->
<text class="fui-letter__key" :class="{'fui-il__key-color':i === touchmoveIndex && !activeBackground}" <text class="fui-letter__key" :class="{'fui-il__key-color':i === touchmoveIndex && !activeBackground}"
:style="{ background: i === touchmoveIndex ? activeBackground : 'transparent', color: i === touchmoveIndex? activeColor : keyColor }">{{ item.letter }}</text> :style="{ background: i === touchmoveIndex ? getActiveBgColor : 'transparent', color: i === touchmoveIndex? activeColor : keyColor }">{{ item.letter }}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -168,15 +166,18 @@ ...@@ -168,15 +166,18 @@
type: String, type: String,
default: '#181818' default: '#181818'
}, },
// #ifdef APP-NVUE
background: { background: {
type: String, type: String,
// #ifdef APP-NVUE
default: '#F1F4FA' default: '#F1F4FA'
},
// #endif // #endif
// #ifndef APP-NVUE // #ifndef APP-NVUE
background: {
type: String,
default: '' default: ''
// #endif
}, },
// #endif
keyColor: { keyColor: {
type: String, type: String,
default: '#7F7F7F' default: '#7F7F7F'
...@@ -187,12 +188,7 @@ ...@@ -187,12 +188,7 @@
}, },
activeBackground: { activeBackground: {
type: String, type: String,
// #ifdef APP-NVUE
default: '#465CFF'
// #endif
// #ifndef APP-NVUE
default: '' default: ''
// #endif
}, },
isSelect: { isSelect: {
type: Boolean, type: Boolean,
...@@ -205,12 +201,7 @@ ...@@ -205,12 +201,7 @@
}, },
selectedColor: { selectedColor: {
type: String, type: String,
// #ifdef APP-NVUE
default: '#465CFF'
// #endif
// #ifndef APP-NVUE
default: '' default: ''
// #endif
}, },
//是否显示图片 //是否显示图片
isSrc: { isSrc: {
...@@ -237,6 +228,19 @@ ...@@ -237,6 +228,19 @@
this.initData() this.initData()
} }
}, },
computed: {
getActiveBgColor() {
let color = this.activeBackground;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color;
}
},
data() { data() {
let isNvue = false; let isNvue = false;
// #ifdef APP-NVUE // #ifdef APP-NVUE
......
<template> <template>
<view :class="{'fui-input__border':inputBorder,'fui-radius__fillet':isFillet}" :style="getStyles" @tap="fieldClick"> <!-- <view :class="{'fui-input__border':inputBorder,'fui-radius__fillet':isFillet}" :style="getStyles" @tap="fieldClick"> -->
<view class="fui-input__wrap" <view class="fui-input__wrap" :class="{'fui-input__border-nvue':inputBorder}"
:class="{'fui-radius__fillet':isFillet,'fui-input__border-radius':inputBorder && !isFillet}" :style="{paddingTop:padding[0] || 0,paddingRight:padding[1] || 0,paddingBottom:padding[2] || padding[0] || 0,paddingLeft:padding[3] || padding[1] || 0,background:backgroundColor,marginTop:marginTop+'rpx',borderRadius:getRadius,borderColor:borderColor}"
:style="{paddingTop:padding[0] || 0,paddingRight:padding[1] || 0,paddingBottom:padding[2] || padding[0] || 0,paddingLeft:padding[3] || padding[1] || 0,backgroundColor:backgroundColor}"> @tap="fieldClick">
<view v-if="borderTop && !inputBorder" <view v-if="borderTop && !inputBorder" :style="{background:borderColor,left:topLeft+'rpx',right:topRight+'rpx'}"
:style="{background:borderColor,left:topLeft+'rpx',right:topRight+'rpx'}" class="fui-input__border-top"> class="fui-input__border-top">
</view> </view>
<!-- #ifndef APP-NVUE -->
<view class="fui-input__border" :style="{borderRadius:getBorderRadius,borderColor:borderColor}"
v-if="inputBorder"></view>
<!-- #endif -->
<!-- #ifdef APP-NVUE --> <!-- #ifdef APP-NVUE -->
<view class="fui-input__required" v-if="required"> <view class="fui-input__required" v-if="required">
<text :style="{color:requiredColor}">*</text> <text :style="{color:requiredColor || dangerColor}">*</text>
</view> </view>
<!-- #endif --> <!-- #endif -->
<!-- #ifndef APP-NVUE --> <!-- #ifndef APP-NVUE -->
<view class="fui-input__required" :style="{color:requiredColor}" v-if="required">*</view> <view class="fui-input__required" :style="{color:requiredColor || dangerColor}" v-if="required">*</view>
<!-- #endif --> <!-- #endif -->
<view class="fui-input__label" :style="{minWidth:labelWidth+'rpx'}" v-if="label"> <view class="fui-input__label" :style="{minWidth:labelWidth+'rpx'}" v-if="label">
<text :style="{fontSize:getLabelSize,color:labelColor}">{{label}}</text> <text :style="{fontSize:getLabelSize,color:labelColor}">{{label}}</text>
...@@ -21,26 +25,24 @@ ...@@ -21,26 +25,24 @@
<!-- 小程序不支持v-bind="{'password':password}" --> <!-- 小程序不支持v-bind="{'password':password}" -->
<!-- #ifdef APP-PLUS || H5 --> <!-- #ifdef APP-PLUS || H5 -->
<input v-bind="attribute" class="fui-input__self" :class="{'fui-input__text-right':textRight}" <input v-bind="attribute" class="fui-input__self" :class="{'fui-input__text-right':textRight}"
:style="{fontSize:getSize,color:color}" placeholder-class="fui-input__placeholder" :type="type" :style="{fontSize:getSize,color:color}" placeholder-class="fui-input__placeholder" :type="type" :name="name"
:name="name" :value="val" :placeholder="placeholder" :placeholder-style="placeholderStyl" :value="val" :placeholder="placeholder" :placeholder-style="placeholderStyl"
:disabled="disabled || readonly" :cursor-spacing="cursorSpacing" :maxlength="maxlength" :focus="focused" :disabled="disabled || readonly" :cursor-spacing="cursorSpacing" :maxlength="maxlength" :focus="focused"
:confirm-type="confirmType" :confirm-hold="confirmHold" :cursor="cursor" :confirm-type="confirmType" :confirm-hold="confirmHold" :cursor="cursor" :selection-start="selectionStart"
:selection-start="selectionStart" :selection-end="selectionEnd" :adjust-position="adjustPosition" :selection-end="selectionEnd" :adjust-position="adjustPosition" :hold-keyboard="holdKeyboard"
:hold-keyboard="holdKeyboard" :auto-blur="autoBlur" :enableNative="false" :always-embed="alwaysEmbed" :auto-blur="autoBlur" :enableNative="false" :always-embed="alwaysEmbed" @focus="onFocus" @blur="onBlur"
@focus="onFocus" @blur="onBlur" @input="onInput" @confirm="onConfirm" @input="onInput" @confirm="onConfirm" @keyboardheightchange="onKeyboardheightchange" />
@keyboardheightchange="onKeyboardheightchange" />
<!-- #endif --> <!-- #endif -->
<!-- #ifndef APP-PLUS || H5 --> <!-- #ifndef APP-PLUS || H5 -->
<input class="fui-input__self" :class="{'fui-input__text-right':textRight}" <input class="fui-input__self" :class="{'fui-input__text-right':textRight}"
:style="{fontSize:getSize,color:color}" placeholder-class="fui-input__placeholder" :type="type" :style="{fontSize:getSize,color:color}" placeholder-class="fui-input__placeholder" :type="type" :name="name"
:name="name" :value="val" :placeholder="placeholder" :password="password" :value="val" :placeholder="placeholder" :password="password" :placeholder-style="placeholderStyl"
:placeholder-style="placeholderStyl" :disabled="disabled || readonly" :cursor-spacing="cursorSpacing" :disabled="disabled || readonly" :cursor-spacing="cursorSpacing" :maxlength="maxlength" :focus="focused"
:maxlength="maxlength" :focus="focused" :confirm-type="confirmType" :confirm-hold="confirmHold" :confirm-type="confirmType" :confirm-hold="confirmHold" :cursor="cursor" :selection-start="selectionStart"
:cursor="cursor" :selection-start="selectionStart" :selection-end="selectionEnd" :selection-end="selectionEnd" :adjust-position="adjustPosition" :hold-keyboard="holdKeyboard"
:adjust-position="adjustPosition" :hold-keyboard="holdKeyboard" :auto-blur="autoBlur" :auto-blur="autoBlur" :enableNative="false" :always-embed="alwaysEmbed" @focus="onFocus" @blur="onBlur"
:enableNative="false" :always-embed="alwaysEmbed" @focus="onFocus" @blur="onBlur" @input="onInput" @input="onInput" @confirm="onConfirm" @keyboardheightchange="onKeyboardheightchange" />
@confirm="onConfirm" @keyboardheightchange="onKeyboardheightchange" />
<!-- #endif --> <!-- #endif -->
<view class="fui-input__clear-wrap" :style="{background:clearColor}" v-if="clearable && val != ''" <view class="fui-input__clear-wrap" :style="{background:clearColor}" v-if="clearable && val != ''"
@tap.stop="onClear"> @tap.stop="onClear">
...@@ -56,23 +58,21 @@ ...@@ -56,23 +58,21 @@
:style="{background:borderColor,left:bottomLeft+'rpx',right:bottomRight+'rpx'}" :style="{background:borderColor,left:bottomLeft+'rpx',right:bottomRight+'rpx'}"
class="fui-input__border-bottom"></view> class="fui-input__border-bottom"></view>
</view> </view>
</view> <!-- </view> -->
</template> </template>
<script> <script>
export default { export default {
name: "fui-input", name: "fui-input",
emits: ['input', 'update:modelValue', 'focus', 'blur', 'confirm', 'click', 'keyboardheightchange'], emits: ['input', 'update:modelValue', 'focus', 'blur', 'confirm', 'click', 'keyboardheightchange'],
// #ifndef VUE3
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
//加group是为了避免在表单中使用时给组件加value属性 //加group是为了避免在表单中使用时给组件加value属性
behaviors: ['wx://form-field-group'], behaviors: ['wx://form-field-group'],
// #endif // #endif
// #ifdef MP-BAIDU || MP-QQ // #ifdef MP-BAIDU || MP-QQ || H5
//如果在这些平台不需要也能识别,则删除 //如果在这些平台不需要也能识别,则删除
behaviors: ['uni://form-field'], behaviors: ['uni://form-field'],
// #endif // #endif
// #endif
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
options: { options: {
addGlobalClass: true, addGlobalClass: true,
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
}, },
requiredColor: { requiredColor: {
type: String, type: String,
default: '#FF2B2B' default: ''
}, },
//左侧标题 //左侧标题
label: { label: {
...@@ -168,7 +168,7 @@ ...@@ -168,7 +168,7 @@
type: Boolean, type: Boolean,
default: false default: false
}, },
readonly:{ readonly: {
type: Boolean, type: Boolean,
default: false default: false
}, },
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
}, },
radius: { radius: {
type: [Number, String], type: [Number, String],
default: -1 default: 8
}, },
borderTop: { borderTop: {
type: Boolean, type: Boolean,
...@@ -304,19 +304,19 @@ ...@@ -304,19 +304,19 @@
} }
}, },
computed: { computed: {
getStyles() { getRadius() {
let styles = `margin-top:${this.marginTop}rpx;` let radius = this.radius + 'rpx'
if (this.isFillet) {
// #ifdef APP-NVUE radius = '120px'
if (this.inputBorder) {
styles += `border-color:${this.borderColor};`
} }
// #endif return radius;
},
if (!this.inputBorder && !this.borderTop && !this.borderBottom && this.radius != -1) { getBorderRadius() {
styles += `border-radius:${this.radius}rpx;overflow:hidden;` let radius = Number(this.radius) * 2 + 'rpx'
if (this.isFillet) {
radius = '240px'
} }
return styles return radius;
}, },
getSize() { getSize() {
const size = (uni.$fui && uni.$fui.fuiInput && uni.$fui.fuiInput.size) || 32 const size = (uni.$fui && uni.$fui.fuiInput && uni.$fui.fuiInput.size) || 32
...@@ -325,6 +325,10 @@ ...@@ -325,6 +325,10 @@
getLabelSize() { getLabelSize() {
const labelSize = (uni.$fui && uni.$fui.fuiInput && uni.$fui.fuiInput.labelSize) || 32 const labelSize = (uni.$fui && uni.$fui.fuiInput && uni.$fui.fuiInput.labelSize) || 32
return `${this.labelSize || labelSize}rpx` return `${this.labelSize || labelSize}rpx`
},
dangerColor() {
const app = uni && uni.$fui && uni.$fui.color;
return (app && app.danger) || '#FF2B2B';
} }
}, },
watch: { watch: {
...@@ -344,8 +348,8 @@ ...@@ -344,8 +348,8 @@
value(newVal) { value(newVal) {
this.val = newVal this.val = newVal
}, },
password:{ password: {
handler(val){ handler(val) {
if (val) { if (val) {
this.attribute = { this.attribute = {
password: true password: true
...@@ -354,7 +358,7 @@ ...@@ -354,7 +358,7 @@
this.attribute = {} this.attribute = {}
} }
}, },
immediate:true immediate: true
} }
}, },
created() { created() {
...@@ -471,6 +475,7 @@ ...@@ -471,6 +475,7 @@
flex: 1; flex: 1;
align-items: center; align-items: center;
position: relative; position: relative;
border-width: 0;
} }
.fui-input__border-top { .fui-input__border-top {
...@@ -615,25 +620,16 @@ ...@@ -615,25 +620,16 @@
/* #endif */ /* #endif */
.fui-input__border {
border-radius: 8rpx;
position: relative;
/* #ifdef APP-NVUE */ /* #ifdef APP-NVUE */
border-style: solid; .fui-input__border-nvue {
border-width: 0.5px; border-width: 0.5px;
/* #endif */ border-style: solid;
/* #ifndef APP-NVUE */
border-width: 0;
/* #endif */
} }
.fui-input__border-radius { /* #endif */
border-radius: 8rpx;
}
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
.fui-input__border::after { .fui-input__border {
content: ' ';
position: absolute; position: absolute;
height: 200%; height: 200%;
width: 200%; width: 200%;
...@@ -646,14 +642,7 @@ ...@@ -646,14 +642,7 @@
pointer-events: none; pointer-events: none;
} }
.fui-radius__fillet::after {
border-radius: 200px !important;
}
/* #endif */ /* #endif */
.fui-radius__fillet {
border-radius: 100px !important;
}
.fui-input__text-right { .fui-input__text-right {
text-align: right; text-align: right;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<view v-if="toolbar" class="fui-lp__btn-wrap" <view v-if="toolbar" class="fui-lp__btn-wrap"
:class="[theme==='light'?'fui-lp__btnwrap-light':'fui-lp__btnwrap-dark']"> :class="[theme==='light'?'fui-lp__btnwrap-light':'fui-lp__btnwrap-dark']">
<text class="fui-lp__button" :class="{'fui-lp__button-color':!color}" <text class="fui-lp__button" :class="{'fui-lp__button-color':!color}"
:style="{color:color,fontSize:size+'rpx',fontWeight:fontWeight}" @tap.stop="onComplete">{{text}}</text> :style="{color:getColor,fontSize:size+'rpx',fontWeight:fontWeight}" @tap.stop="onComplete">{{text}}</text>
</view> </view>
<view class="fui-license__plate-grids"> <view class="fui-license__plate-grids">
<view class="fui-lp__grid-wrap" v-for="(item,index) in keyList" :key="item.id"> <view class="fui-lp__grid-wrap" v-for="(item,index) in keyList" :key="item.id">
...@@ -56,18 +56,10 @@ ...@@ -56,18 +56,10 @@
type: String, type: String,
default: '完成' default: '完成'
}, },
// #ifdef APP-NVUE
color: {
type: String,
default: '#465CFF'
},
// #endif
// #ifndef APP-NVUE
color: { color: {
type: String, type: String,
default: '' default: ''
}, },
// #endif
size: { size: {
type: [Number, String], type: [Number, String],
default: 30 default: 30
...@@ -108,6 +100,18 @@ ...@@ -108,6 +100,18 @@
} }
// #endif // #endif
}, },
computed: {
getColor() {
let color = this.color;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color;
}
},
data() { data() {
return { return {
iphoneX: false, iphoneX: false,
......
<template> <template>
<a v-if="isShowA" class="fui-link__text" :href="href" <a v-if="isShowA" class="fui-link__text" :href="href"
:class="{'fui-link__underline':underline,'fui-link__defcolor':!color,'fui-link__active':highlight}" :class="{'fui-link__underline':underline,'fui-link__defcolor':!color,'fui-link__active':highlight}"
:style="{color,fontSize:size+'rpx',fontWeight:fontWeight}" :download="download"> :style="{color:getColor,fontSize:size+'rpx',fontWeight:fontWeight}" :download="download">
<slot>{{text || href}}</slot> <slot>{{text || href}}</slot>
</a> </a>
<!-- #ifndef APP-NVUE --> <!-- #ifndef APP-NVUE -->
<text v-else class="fui-link__text" :class="{'fui-link__underline':underline,'fui-link__defcolor':!color,'fui-link__active':highlight}" <text v-else class="fui-link__text" :class="{'fui-link__underline':underline,'fui-link__defcolor':!color,'fui-link__active':highlight}"
:style="{color,fontSize:size+'rpx',fontWeight:fontWeight}" @tap="openURL"> :style="{color:getColor,fontSize:size+'rpx',fontWeight:fontWeight}" @tap="openURL">
<slot>{{text || href}}</slot> <slot>{{text || href}}</slot>
</text> </text>
<!-- #endif --> <!-- #endif -->
<!-- #ifdef APP-NVUE --> <!-- #ifdef APP-NVUE -->
<text v-else class="fui-link__text" :class="{'fui-link__underline':underline,'fui-link__defcolor':!color,'fui-link__active':highlight}" <text v-else class="fui-link__text" :class="{'fui-link__underline':underline,'fui-link__defcolor':!color,'fui-link__active':highlight}"
:style="{color,fontSize:size+'rpx',fontWeight:fontWeight}" @tap="openURL">{{text || href}}</text> :style="{color:getColor,fontSize:size+'rpx',fontWeight:fontWeight}" @tap="openURL">{{text || href}}</text>
<!-- #endif --> <!-- #endif -->
</template> </template>
...@@ -45,18 +45,10 @@ ...@@ -45,18 +45,10 @@
type: String, type: String,
default: '链接已复制' default: '链接已复制'
}, },
// #ifdef APP-NVUE
color: {
type: String,
default: '#465CFF'
},
// #endif
// #ifndef APP-NVUE
color: { color: {
type: String, type: String,
default: '' default: ''
}, },
// #endif
size: { size: {
type: [Number, String], type: [Number, String],
default: 28 default: 28
...@@ -80,6 +72,16 @@ ...@@ -80,6 +72,16 @@
return true; return true;
} }
return false; return false;
},
getColor() {
let color = this.color;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.link) || '#465CFF';
}
// #endif
return color;
} }
}, },
methods: { methods: {
...@@ -135,7 +137,7 @@ ...@@ -135,7 +137,7 @@
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
.fui-link__defcolor { .fui-link__defcolor {
color: var(--fui-color-primary, #465CFF) !important; color: var(--fui-color-link, #465CFF) !important;
} }
/* #endif */ /* #endif */
......
<template> <template>
<view class="fui-list__cell" :class="{'fui-highlight':highlight,'fui-list__cell-background':!background}" <view class="fui-list__cell" :class="{'fui-highlight':highlight,'fui-list__cell-background':!background}"
:style="{paddingTop:padding[0] || 0,paddingRight:padding[1] || 0,paddingBottom:padding[2] || padding[0] || 0,paddingLeft:padding[3] || padding[1] || 0,background:background,marginTop:marginTop+'rpx',marginBottom:marginBottom+'rpx',borderRadius:radius}" :style="{paddingTop:getPadding[0] || 0,paddingRight:getPadding[1] || 0,paddingBottom:getPadding[2] || getPadding[0] || 0,paddingLeft:getPadding[3] || getPadding[1] || 0,background:background,marginTop:marginTop+'rpx',marginBottom:marginBottom+'rpx',borderRadius:radius}"
@tap="handleClick"> @tap="handleClick">
<view v-if="topBorder" :style="{background:borderColor,left:topLeft+'rpx',right:topRight+'rpx'}" <view v-if="topBorder" :style="{background:getBorderColor,left:topLeft+'rpx',right:topRight+'rpx'}"
class="fui-cell__border-top" :class="{'fui-cell__border-color':!borderColor}"></view> class="fui-cell__border-top" :class="{'fui-cell__border-color':!getBorderColor}"></view>
<slot></slot> <slot></slot>
<view v-if="bottomBorder" :style="{background:borderColor,left:bottomLeft+'rpx',right:bottomRight+'rpx'}" <view v-if="bottomBorder" :style="{background:getBorderColor,left:getBottomLeft+'rpx',right:bottomRight+'rpx'}"
class="fui-cell__border-bottom" :class="{'fui-cell__border-color':!borderColor}"></view> class="fui-cell__border-bottom" :class="{'fui-cell__border-color':!getBorderColor}"></view>
<view class="fui-cell__arrow" v-if="arrow" :style="{'border-color':arrowColor}"> <view class="fui-cell__arrow" v-if="arrow" :style="{'border-color':getArrowColor}">
</view> </view>
</view> </view>
</template> </template>
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
padding: { padding: {
type: Array, type: Array,
default () { default () {
return ['32rpx', '32rpx'] return []
} }
}, },
//margin-top 单位rpx //margin-top 单位rpx
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
}, },
arrowColor: { arrowColor: {
type: String, type: String,
default: '#B2B2B2' default: ''
}, },
//是否显示上边框 //是否显示上边框
topBorder: { topBorder: {
...@@ -72,18 +72,10 @@ ...@@ -72,18 +72,10 @@
default: true default: true
}, },
//边框颜色,非nvue下传值则全局默认样式失效 //边框颜色,非nvue下传值则全局默认样式失效
// #ifdef APP-NVUE
borderColor: {
type: String,
default: '#EEEEEE'
},
// #endif
// #ifndef APP-NVUE
borderColor: { borderColor: {
type: String, type: String,
default: '' default: ''
}, },
// #endif
//上边框left值,单位rpx //上边框left值,单位rpx
topLeft: { topLeft: {
type: [Number, String], type: [Number, String],
...@@ -97,7 +89,7 @@ ...@@ -97,7 +89,7 @@
//下边框left值,单位rpx //下边框left值,单位rpx
bottomLeft: { bottomLeft: {
type: [Number, String], type: [Number, String],
default: 32 default: 0
}, },
//下边框right值,单位rpx //下边框right值,单位rpx
bottomRight: { bottomRight: {
...@@ -114,6 +106,37 @@ ...@@ -114,6 +106,37 @@
default: 0 default: 0
} }
}, },
computed: {
getPadding() {
let padding = this.padding
if (Array.isArray(padding) && padding.length === 0) {
const app = uni && uni.$fui && uni.$fui.fuiListCell;
padding = app && app.padding;
if (!padding || (Array.isArray(padding) && padding.length === 0)) {
padding = ['32rpx', '32rpx']
}
}
return padding;
},
getArrowColor() {
const app = uni && uni.$fui && uni.$fui.fuiListCell;
return this.arrowColor || (app && app.arrowColor) || '#B2B2B2'
},
getBorderColor() {
let color = this.borderColor;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.fuiListCell;
color = (app && app.borderColor) || '#EEEEEE'
}
// #endif
return color;
},
getBottomLeft() {
const app = uni && uni.$fui && uni.$fui.fuiListCell;
return this.bottomLeft || (app && app.bottomLeft) || 32
}
},
methods: { methods: {
handleClick() { handleClick() {
this.$emit('click', { this.$emit('click', {
...@@ -200,6 +223,7 @@ ...@@ -200,6 +223,7 @@
.fui-cell__border-color { .fui-cell__border-color {
background-color: var(--fui-color-border, #EEEEEE) !important; background-color: var(--fui-color-border, #EEEEEE) !important;
} }
.fui-list__cell-background { .fui-list__cell-background {
background-color: var(--fui-bg-color, #fff); background-color: var(--fui-bg-color, #fff);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view class="fui-loadmore__wrap" :class="['fui-loadmore__'+direction]" :style="{height:height+'rpx'}"> <view class="fui-loadmore__wrap" :class="['fui-loadmore__'+direction]" :style="{height:height+'rpx'}">
<view class="fui-loadmore__icon" ref="fui_loadmore" <view class="fui-loadmore__icon" ref="fui_loadmore"
:class="{'fui-loadmore__border-left':!isNvue && !activeColor}" :class="{'fui-loadmore__border-left':!isNvue && !activeColor}"
:style="{width:iconWidth+'rpx',height:iconWidth+'rpx','border-left-color':activeColor,'border-right-color':iconColor,'border-top-color':iconColor,'border-bottom-color':iconColor}" :style="{width:iconWidth+'rpx',height:iconWidth+'rpx','border-left-color':getActiveColor,'border-right-color':iconColor,'border-top-color':iconColor,'border-bottom-color':iconColor}"
v-if="!src && state==2"> v-if="!src && state==2">
</view> </view>
<image class="fui-loadmore__icon-ani" ref="fui_loadmore" :src="src" <image class="fui-loadmore__icon-ani" ref="fui_loadmore" :src="src"
...@@ -60,12 +60,7 @@ ...@@ -60,12 +60,7 @@
//loading图标高亮部分颜色 //loading图标高亮部分颜色
activeColor: { activeColor: {
type: String, type: String,
// #ifdef APP-NVUE
default: "#465CFF"
// #endif
// #ifndef APP-NVUE
default: "" default: ""
// #endif
}, },
//loading 图标的宽度,单位rpx //loading 图标的宽度,单位rpx
iconWidth: { iconWidth: {
...@@ -104,6 +99,18 @@ ...@@ -104,6 +99,18 @@
}) })
} }
}, },
computed: {
getActiveColor() {
let color = this.activeColor;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color;
}
},
data() { data() {
let isNvue = false; let isNvue = false;
// #ifdef APP-NVUE // #ifdef APP-NVUE
......
...@@ -14,11 +14,12 @@ ...@@ -14,11 +14,12 @@
v-if="vals.length>0"> v-if="vals.length>0">
<view class="fui-modal__button" <view class="fui-modal__button"
:class="{'fui-modal__button-col':direction==='column' && index!==vals.length-1,'fui-modal__button-bg':!entity.plain && !entity.background,'fui-modal__button-border':entity.plain,'fui-modal__button-bc':entity.plain && !entity.background}" :class="{'fui-modal__button-col':direction==='column' && index!==vals.length-1,'fui-modal__button-bg':!entity.plain && !entity.background,'fui-modal__button-border':entity.plain,'fui-modal__button-bc':entity.plain && !entity.background}"
:style="{borderRadius:radius+'rpx',background:entity.plain?'transparent':(entity.background || '#465CFF'),borderColor:entity.plain?(entity.background || '#465CFF'):'transparent'}" :style="{borderRadius:radius+'rpx',background:entity.plain?'transparent':(entity.background || primaryColor),borderColor:entity.plain?(entity.background || primaryColor):'transparent'}"
v-for="(entity,index) in vals" :key="index"> v-for="(entity,index) in vals" :key="index">
<text class="fui-modal__button-inner" <text class="fui-modal__button-inner"
:class="{'fui-modal__button-color': !entity.color && entity.plain}" :class="{'fui-modal__button-color': !entity.color && entity.plain}"
:style="{color:entity.color || (entity.plain?'#465CFF':'#fff'),borderRadius:radius+'rpx'}" @tap.stop="handleClick($event,index)">{{entity.text}}</text> :style="{color:entity.color || (entity.plain?primaryColor:'#fff'),borderRadius:radius+'rpx'}"
@tap.stop="handleClick($event,index)">{{entity.text}}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -127,6 +128,10 @@ ...@@ -127,6 +128,10 @@
computed: { computed: {
getWidth() { getWidth() {
return "width:" + (Number(this.width) - 60) + 'rpx' return "width:" + (Number(this.width) - 60) + 'rpx'
},
primaryColor() {
const app = uni && uni.$fui && uni.$fui.color;
return (app && app.primary) || '#465CFF';
} }
}, },
watch: { watch: {
......
// #ifdef APP-NVUE
const animation = uni.requireNativePlugin('animation');
export default {
data() {
return {
startX: 0,
startY: 0,
lastLeft: 0,
lastTop: 0
}
},
created() {
this.refFab = null;
this.loop = null
},
mounted() {
this.$nextTick(() => {
setTimeout(() => {
this.refFab = this.getEl(this.$refs['fui-movable__view'])
}, 50)
})
},
methods: {
getEl(el) {
return el.ref || el[0].ref;
},
_aniMove(x, y) {
if (!this.refFab || this.direction === 'none') return
animation.transition(this.refFab, {
styles: {
transform: `translate(${x}px,${y}px)`
},
duration: 0,
timingFunction: 'linear',
needLayout: false,
delay: 0
}, () => {
this.change({
left: x,
top: y
})
});
},
touchstart(e) {
if (this.direction === 'none') return;
var touch = e.touches || e.changedTouches
if (this.direction === 'all') {
this.startX = touch[0].screenX
this.startY = touch[0].screenY
} else if (this.direction === 'vertical') {
this.startY = touch[0].screenY
} else {
this.startX = touch[0].screenX
}
},
getLeft(pageX) {
var left = pageX - this.startX + this.lastLeft;
left = left < -this.eLeft ? -this.eLeft : left;
left = left > this.maxWidth ? this.maxWidth : left;
return left
},
getTop(pageY) {
var top = pageY - this.startY + this.lastTop;
top = top < -this.eTop ? -this.eTop : top;
top = top > this.maxHeight ? this.maxHeight : top;
return top
},
touchmove(e) {
if (this.direction === 'none') return;
var touch = e.touches || e.changedTouches
let pageX = touch[0].screenX,
pageY = touch[0].screenY;
let left = 0,
top = 0;
if (this.direction === 'all') {
left = this.getLeft(pageX)
this.startX = pageX
top = this.getTop(pageY)
this.startY = pageY
} else if (this.direction === 'vertical') {
top = this.getTop(pageY)
this.startY = pageY
} else {
left = this.getLeft(pageX)
this.startX = pageX
}
this.lastLeft = left
this.lastTop = top
this._aniMove(left, top)
}
}
}
// #endif
// #ifndef APP-NVUE
export default {}
// #endif
<template>
<view>
<!-- #ifdef APP-VUE || H5 -->
<view class="fui-movable__view" :class="{'fui-movable__cursor':direction!=='none'}" :data-direction="direction"
:data-width="maxWidth" :data-height="maxHeight" :data-left="eLeft" :data-top="eTop"
@touchstart="handler.touchstart" @touchmove="handler.touchmove" @mousedown="handler.mousedown"
:style="getStyles">
<slot></slot>
</view>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<view class="fui-movable__view" :class="{'fui-movable__cursor':direction!=='none'}" :data-direction="direction"
:data-width="maxWidth" :data-height="maxHeight" :data-left="eLeft" :data-top="eTop"
@touchstart="handler.touchstart" :catchtouchmove="handler.touchmove" :style="getStyles">
<slot></slot>
</view>
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<view class="fui-movable__view" @touchstart="touchstart" @touchmove.stop.prevent="touchmove"
ref="fui-movable__view" :style="getStyles">
<slot></slot>
</view>
<!-- #endif -->
<!-- #ifndef APP-PLUS || MP-WEIXIN || H5 -->
<view class="fui-movable__view" @touchstart="touchstart" @touchmove.stop.prevent="touchmove" :style="getStyles">
<slot></slot>
</view>
<!-- #endif -->
</view>
</template>
<!-- #ifdef APP-VUE || MP-WEIXIN || H5-->
<script src="./index.wxs" module="handler" lang="wxs"></script>
<!-- #endif -->
<script>
// #ifdef APP-NVUE
const animation = uni.requireNativePlugin('animation');
const dom = uni.requireNativePlugin('dom');
// #endif
import mpjs from './mpjs.js'
import bindingx from './bindingx.js'
export default {
name: "fui-movable-view",
emits: ['change'],
mixins: [mpjs, bindingx],
props: {
//left值,设置大于-1的值则right失效
left: {
type: [Number, String],
default: -1
},
right: {
type: [Number, String],
default: 80
},
//top值,设置大于-1的值则bottom失效
top: {
type: [Number, String],
default: -1
},
bottom: {
type: [Number, String],
default: 120
},
zIndex: {
type: [Number, String],
default: 10
},
//移动方向,属性值有all、vertical、horizontal、none
direction: {
type: String,
default: 'all'
}
},
data() {
return {
maxWidth: 0,
maxHeight: 0,
eLeft: 0,
eTop: 0,
};
},
watch: {
position(val) {
this.$nextTick(() => {
setTimeout(() => {
this._getSize()
}, 50);
})
}
},
mounted() {
this.$nextTick(() => {
setTimeout(() => {
this._getSize()
}, 50);
})
},
computed: {
position() {
return `${this.left}_${this.right}_${this.top}_${this.bottom}`
},
getStyles() {
let styles = `z-index:${this.zIndex};`
if (this.left != -1) {
styles += `left:${this.left}rpx;`
} else {
styles += `right:${this.right}rpx;`
}
if (this.top != -1) {
styles += `top:${this.top}rpx;`
} else {
styles += `bottom:${this.bottom}rpx;`
}
// #ifndef APP-PLUS || MP-WEIXIN || H5
if (this.direction !== 'none') {
styles += `transform:${this.transform};`
}
// #endif
return styles;
}
},
methods: {
_getSize() {
const sys = uni.getSystemInfoSync()
// #ifndef APP-NVUE
uni.createSelectorQuery()
// #ifndef MP-ALIPAY
.in(this)
// #endif
.select('.fui-movable__view')
.boundingClientRect()
.exec(ret => {
if (ret) {
this.maxWidth = sys.windowWidth - ret[0].width - ret[0].left;
this.maxHeight = sys.windowHeight - ret[0].height - ret[0].top;
this.eLeft = ret[0].left || 0;
this.eTop = ret[0].top || 0;
this.change({
left: 0,
top: 0
})
}
})
// #endif
// #ifdef APP-NVUE
dom.getComponentRect(this.$refs['fui-movable__view'], (ret) => {
const size = ret.size
if (size) {
this.maxWidth = sys.windowWidth - size.width - size.left;
this.maxHeight = sys.windowHeight - size.height - size.top;
this.eLeft = size.left || 0;
this.eTop = size.top || 0;
this.change({
left: 0,
top: 0
})
}
})
// #endif
},
reset() {
setTimeout(() => {
this._getSize()
}, 50);
},
change(e) {
this.$emit('change', {
x: e.left + this.eLeft,
y: e.top + this.eTop
})
}
}
}
</script>
<style scoped>
.fui-movable__view {
position: fixed;
}
/* #ifdef H5 */
.fui-movable__cursor {
cursor: grab;
}
/* #endif */
</style>
var movable = {
width: 100,
height: 100,
direction: '',
left: 0,
top: 0
}
function isPC() {
if (typeof navigator !== 'object') return false;
var userAgentInfo = navigator.userAgent;
var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
var flag = true;
for (var v = 0; v< Agents.length - 1; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) {
flag = false;
break;
}
}
return flag;
}
var isH5 = false
if (typeof window === 'object') isH5 = true
function setInitValue(dataset, isChange) {
movable.width = +dataset.width
movable.height = +dataset.height
movable.top = +dataset.top
movable.left = +dataset.left
movable.direction = dataset.direction
}
function touchstart(e, ins) {
if (movable.direction == 'none') return;
var state = e.instance.getState()
var touch = e.touches[0] || e.changedTouches[0];
if (isH5 && isPC()) {
touch = e;
}
var dataset = e.instance.getDataset()
if (movable.direction == 'all') {
state.startX = touch.clientX
state.startY = touch.clientY
} else if (movable.direction == 'vertical') {
state.startY = touch.clientY
} else {
state.startX = touch.clientX
}
setInitValue(dataset)
}
function styleChange(left, top, ins) {
if (!ins) return;
var mview = ins.selectComponent('.fui-movable__view');
if (!mview) return;
mview.setStyle({
transform: 'translate3d(' + left + 'px,' + top + 'px,0)'
})
ins.callMethod('change', {
left: left,
top: top
})
}
function getLeft(pageX, state) {
var left = pageX - state.startX + (state.lastLeft || 0);
left = left < -movable.left ? -movable.left : left;
left = left > movable.width ? movable.width : left;
return left
}
function getTop(pageY, state) {
var top = pageY - state.startY + (state.lastTop || 0);
top = top < -movable.top ? -movable.top : top;
top = top > movable.height ? movable.height : top;
return top
}
function touchmove(e, ins, event) {
if (movable.direction == 'none') return;
if (e.preventDefault) {
// 阻止页面滚动
e.preventDefault()
}
var state = {}
var touch = {}
if (isH5 && isPC()) {
touch = e;
state = event.instance.getState()
} else {
touch = e.touches[0] || e.changedTouches[0]
state = e.instance.getState()
}
var pageX = touch.clientX;
var pageY = touch.clientY;
var left = 0,
top = 0;
if (movable.direction == 'all') {
left = getLeft(pageX, state)
state.startX = pageX
top = getTop(pageY, state)
state.startY = pageY
} else if (movable.direction == 'vertical') {
top = getTop(pageY, state)
state.startY = pageY
} else {
left = getLeft(pageX, state)
state.startX = pageX
}
state.lastLeft = left
state.lastTop = top
styleChange(left, top, ins)
}
var _movable = false;
function mousedown(e, ins) {
if (!isH5 || !isPC()) return
touchstart(e, ins)
_movable = true
window.onmousemove = function(event) {
if (!isH5 || !isPC() || !_movable) return
touchmove(event, ins, e)
}
window.onmouseup = function(event) {
if (!isH5 || !isPC() || !_movable) return
_movable = false
}
}
module.exports = {
touchstart: touchstart,
touchmove: touchmove,
mousedown: mousedown
}
// #ifndef APP-PLUS || MP-WEIXIN || H5
export default {
data() {
return {
startX: 0,
startY: 0,
lastLeft: 0,
lastTop: 0,
transform: ''
}
},
methods: {
touchstart(e) {
if (this.direction === 'none') return;
const touch = e.touches || e.changedTouches
if (this.direction === 'all') {
this.startX = touch[0].clientX
this.startY = touch[0].clientY
} else if (this.direction === 'vertical') {
this.startY = touch[0].clientY
} else {
this.startX = touch[0].clientX
}
},
getLeft(pageX) {
var left = pageX - this.startX + this.lastLeft;
left = left < -this.eLeft ? -this.eLeft : left;
left = left > this.maxWidth ? this.maxWidth : left;
return left
},
getTop(pageY, state) {
var top = pageY - this.startY + this.lastTop;
top = top < -this.eTop ? -this.eTop : top;
top = top > this.maxHeight ? this.maxHeight : top;
return top
},
touchmove(e) {
if (this.direction == 'none') return;
const touch = e.touches || e.changedTouches
let pageX = touch[0].clientX,
pageY = touch[0].clientY;
let left = 0,
top = 0;
if (this.direction === 'all') {
left = this.getLeft(pageX)
this.startX = pageX
top = this.getTop(pageY)
this.startY = pageY
} else if (this.direction === 'vertical') {
top = this.getTop(pageY)
this.startY = pageY
} else {
left = this.getLeft(pageX)
this.startX = pageX
}
this.lastLeft = left
this.lastTop = top
this.transform = `translate3d(${left}px,${top}px,0)`
this.change({
left,
top
})
}
}
}
// #endif
// #ifdef APP-PLUS|| MP-WEIXIN || H5
export default {}
// #endif
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<view :id="elId_box" <view :id="elId_box"
:class="{'fui-notice__content':scrollable,'fui-notice__content-single':!scrollable && single}"> :class="{'fui-notice__content':scrollable,'fui-notice__content-single':!scrollable && single}">
<text ref="animationEle" class="fui-notice__text" :id="elId" <text ref="animationEle" class="fui-notice__text" :id="elId"
:style="{color:color,fontSize:size+'rpx',lineHeight:scrollable && !isNvue?size+'rpx':'normal',fontWeight:bold?'bold':'normal',width:wrapWidth+'px', 'animationDuration': animationDuration,'-webkit-animationDuration': animationDuration,animationPlayState: webviewHide?'paused':animationPlayState,'-webkit-animationPlayState':webviewHide?'paused':animationPlayState, animationDelay: animationDelay, '-webkit-animationDelay':animationDelay}" :style="{color:getColor,fontSize:size+'rpx',lineHeight:scrollable && !isNvue?size+'rpx':'normal',fontWeight:bold?'bold':'normal',width:wrapWidth+'px', 'animationDuration': animationDuration,'-webkit-animationDuration': animationDuration,animationPlayState: webviewHide?'paused':animationPlayState,'-webkit-animationPlayState':webviewHide?'paused':animationPlayState, animationDelay: animationDelay, '-webkit-animationDelay':animationDelay}"
:class="{'fui-notice__single':!scrollable && single,'fui-notice__scrollable':scrollable,'fui-notice__text-color':!color && !isNvue}">{{content}}</text> :class="{'fui-notice__single':!scrollable && single,'fui-notice__scrollable':scrollable,'fui-notice__text-color':!color && !isNvue}">{{content}}</text>
</view> </view>
</view> </view>
...@@ -43,12 +43,7 @@ ...@@ -43,12 +43,7 @@
}, },
color: { color: {
type: String, type: String,
// #ifdef APP-NVUE
default: '#FF2B2B'
// #endif
// #ifndef APP-NVUE
default: '' default: ''
// #endif
}, },
bold: { bold: {
type: Boolean, type: Boolean,
...@@ -85,6 +80,18 @@ ...@@ -85,6 +80,18 @@
default: 0 default: 0
} }
}, },
computed: {
getColor() {
let color = this.color;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.danger) || '#FF2B2B';
}
// #endif
return color;
}
},
data() { data() {
const elId = `fui_${Math.ceil(Math.random() * 10e5).toString(36)}` const elId = `fui_${Math.ceil(Math.random() * 10e5).toString(36)}`
const elId_box = `fui_${Math.ceil(Math.random() * 10e5).toString(36)}` const elId_box = `fui_${Math.ceil(Math.random() * 10e5).toString(36)}`
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
</view> </view>
<view class="fui-pagination__num" v-if="isPage && pageType==1"> <view class="fui-pagination__num" v-if="isPage && pageType==1">
<text :class="{'fui-pagination__active-color':!currentColor}" <text :class="{'fui-pagination__active-color':!currentColor}"
:style="{color:currentColor,fontSize:pageFontSize+'rpx'}">{{currentIndex}}</text> :style="{color:getCurrentColor,fontSize:pageFontSize+'rpx'}">{{currentIndex}}</text>
<text :class="{'fui-pagination__color':!pageColor}" <text :class="{'fui-pagination__color':!pageColor}"
:style="{color:pageColor,fontSize:pageFontSize+'rpx'}">/{{maxPage || 0}}</text> :style="{color:pageColor,fontSize:pageFontSize+'rpx'}">/{{maxPage || 0}}</text>
</view> </view>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<view class="fui-page__number" v-if="isPage && pageType==2"> <view class="fui-page__number" v-if="isPage && pageType==2">
<view class="fui-page__num-item" :class="{'fui-pagination__bg':!activeBgColor && currentIndex===item}" <view class="fui-page__num-item" :class="{'fui-pagination__bg':!activeBgColor && currentIndex===item}"
v-for="(item,index) in pageNumber" :key="index" v-for="(item,index) in pageNumber" :key="index"
:style="{background:currentIndex===item?activeBgColor:pageBgColor,borderRadius:radius+'rpx'}" :style="{background:currentIndex===item?getActiveBgColor:pageBgColor,borderRadius:radius+'rpx'}"
@tap.stop="handleClick(item,index)"> @tap.stop="handleClick(item,index)">
<text class="fui-page__num-text" :class="{'fui-pagination__color':!color && currentIndex!==item}" <text class="fui-page__num-text" :class="{'fui-pagination__color':!color && currentIndex!==item}"
:style="{color:currentIndex===item?activeColor:pageColor}">{{item}}</text> :style="{color:currentIndex===item?activeColor:pageColor}">{{item}}</text>
...@@ -100,23 +100,21 @@ ...@@ -100,23 +100,21 @@
//当前页码字体颜色 //当前页码字体颜色
currentColor: { currentColor: {
type: String, type: String,
// #ifdef APP-NVUE
default: '#465CFF'
// #endif
// #ifndef APP-NVUE
default: '' default: ''
// #endif
}, },
//页码字体颜色 //页码字体颜色
// #ifdef APP-NVUE
pageColor: { pageColor: {
type: String, type: String,
// #ifdef APP-NVUE default: '#333',
default: '#333' },
// #endif // #endif
// #ifndef APP-NVUE // #ifndef APP-NVUE
pageColor: {
type: String,
default: '' default: ''
// #endif
}, },
// #endif
//页码字体大小 //页码字体大小
pageFontSize: { pageFontSize: {
type: [Number, String], type: [Number, String],
...@@ -138,12 +136,7 @@ ...@@ -138,12 +136,7 @@
}, },
activeBgColor: { activeBgColor: {
type: String, type: String,
// #ifdef APP-NVUE
default: '#465CFF'
// #endif
// #ifndef APP-NVUE
default: '' default: ''
// #endif
}, },
activeColor: { activeColor: {
type: String, type: String,
...@@ -169,6 +162,26 @@ ...@@ -169,6 +162,26 @@
maxPage = Math.ceil(total / pageSize) maxPage = Math.ceil(total / pageSize)
} }
return maxPage return maxPage
},
getCurrentColor() {
let color = this.currentColor;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color;
},
getActiveBgColor() {
let color = this.activeBgColor;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color;
} }
}, },
watch: { watch: {
......
...@@ -265,8 +265,15 @@ ...@@ -265,8 +265,15 @@
}, },
confrimStyl() { confrimStyl() {
let styles = `font-size:${this.btnSize}rpx;` let styles = `font-size:${this.btnSize}rpx;`
if (this.confirmColor) { let color = this.confirmColor;
styles += `color:${this.confirmColor};` // #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
if (color) {
styles += `color:${color};`
} }
return styles return styles
}, },
...@@ -318,18 +325,25 @@ ...@@ -318,18 +325,25 @@
this.initialize() this.initialize()
}, 50) }, 50)
}, },
// #ifdef APP-NVUE
isShow: { isShow: {
handler(newVal) { handler(newVal) {
if (newVal) { if (newVal) {
// #ifdef APP-NVUE
this.openPicker(); this.openPicker();
// #endif
// #ifndef APP-NVUE
this.isInitShow = true;
// #endif
} else { } else {
// #ifdef APP-NVUE
this.closePicker(); this.closePicker();
// #endif
} }
}, },
immediate: true immediate: true
}, },
// #endif
show(val) { show(val) {
this.isShow = val; this.isShow = val;
} }
...@@ -355,7 +369,8 @@ ...@@ -355,7 +369,8 @@
vKey: 'value', vKey: 'value',
cKey: 'children', cKey: 'children',
isEnd: true, isEnd: true,
isShow: false isShow: false,
isInitShow: false
}; };
}, },
methods: { methods: {
...@@ -553,14 +568,14 @@ ...@@ -553,14 +568,14 @@
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(() => { setTimeout(() => {
this.vals = vals; this.vals = vals;
}, 50) }, 150)
}) })
} else { } else {
this.vals = [] this.vals = []
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(() => { setTimeout(() => {
this.reset() this.reset()
}, 50) }, 150)
}) })
} }
}, },
...@@ -700,6 +715,7 @@ ...@@ -700,6 +715,7 @@
}, 50) }, 50)
}, },
pickerChange(e) { pickerChange(e) {
if (!this.isInitShow) return;
let value = e.detail.value; let value = e.detail.value;
if (this.linkage) { if (this.linkage) {
if (this.layer == 1) { if (this.layer == 1) {
...@@ -952,16 +968,12 @@ ...@@ -952,16 +968,12 @@
color: #D1D1D1; color: #D1D1D1;
} }
.fui-pk__sure-color {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
.fui-pk__sure-color {
color: var(--fui-color-primary, #465CFF) !important; color: var(--fui-color-primary, #465CFF) !important;
/* #endif */
/* #ifdef APP-NVUE */
color: #465CFF;
/* #endif */
} }
/* #endif */
.fui-picker__view { .fui-picker__view {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
width: 100%; width: 100%;
......
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
:style="{ height: height + 'rpx', borderRadius: radius+'rpx', background: background }"> :style="{ height: height + 'rpx', borderRadius: radius+'rpx', background: background }">
<!-- #ifndef APP-NVUE --> <!-- #ifndef APP-NVUE -->
<view class="fui-progress__bar" :class="{'fui-progress__active-color':!activeColor}" <view class="fui-progress__bar" :class="{'fui-progress__active-color':!activeColor}"
:style="{background: activeColor ,transform:`translate3d(-${translateX},0,0)`,transitionDuration:`${time}s`}"> :style="{background: getActiveColor ,transform:`translate3d(-${translateX},0,0)`,transitionDuration:`${time}s`}">
</view> </view>
<!-- #endif --> <!-- #endif -->
<!-- #ifdef APP-NVUE --> <!-- #ifdef APP-NVUE -->
<view ref="fui_pg_ani" class="fui-progress__bar" :style="{background: activeColor}"></view> <view ref="fui_pg_ani" class="fui-progress__bar" :style="{background: getActiveColor}"></view>
<!-- #endif --> <!-- #endif -->
</view> </view>
<text class="fui-progress__percent" <text class="fui-progress__percent"
...@@ -66,12 +66,7 @@ ...@@ -66,12 +66,7 @@
//已选进度条颜色,可渐变 //已选进度条颜色,可渐变
activeColor: { activeColor: {
type: String, type: String,
// #ifdef APP-NVUE
default: '#465CFF'
// #endif
// #ifndef APP-NVUE
default: '' default: ''
// #endif
}, },
//进度增加1%所需毫秒数 //进度增加1%所需毫秒数
duration: { duration: {
...@@ -87,6 +82,18 @@ ...@@ -87,6 +82,18 @@
mounted() { mounted() {
this.darwProgress(); this.darwProgress();
}, },
computed: {
getActiveColor() {
let color = this.activeColor;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color;
}
},
data() { data() {
return { return {
percentage: 0, percentage: 0,
......
...@@ -41,8 +41,8 @@ ...@@ -41,8 +41,8 @@
</view> </view>
<!-- #endif --> <!-- #endif -->
<!-- #ifdef APP-NVUE --> <!-- #ifdef APP-NVUE -->
<view ref="sliderRef" class="fui-sc__slider" :class="{'fui-sc__slider-bg':!sliderBgColor}" <view ref="sliderRef" class="fui-sc__slider"
:style="{width:(sliderH * 2)+'px',height:sliderH+'px',borderRadius:sliderH+'px',background:sliderBgColor}" :style="{width:(sliderH * 2)+'px',height:sliderH+'px',borderRadius:sliderH+'px',background:getSliderBgColor}"
@touchstart="touchstart" @horizontalpan="touchmove" @touchend="touchend"> @touchstart="touchstart" @horizontalpan="touchmove" @touchend="touchend">
<fui-icon name="slide" :size="56" :color="slideColor"></fui-icon> <fui-icon name="slide" :size="56" :color="slideColor"></fui-icon>
</view> </view>
...@@ -131,18 +131,10 @@ ...@@ -131,18 +131,10 @@
type: String, type: String,
default: '#B2B2B2' default: '#B2B2B2'
}, },
// #ifdef APP-NVUE
sliderBgColor: {
type: String,
default: '#465CFF'
},
// #endif
// #ifndef APP-NVUE
sliderBgColor: { sliderBgColor: {
type: String, type: String,
default: '' default: ''
}, },
// #endif
slideColor: { slideColor: {
type: String, type: String,
default: '#FFFFFF' default: '#FFFFFF'
...@@ -168,6 +160,18 @@ ...@@ -168,6 +160,18 @@
this.reset() this.reset()
} }
}, },
computed: {
getSliderBgColor() {
let color = this.sliderBgColor
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color
}
},
data() { data() {
let sys = uni.getSystemInfoSync() let sys = uni.getSystemInfoSync()
let isNvue = false let isNvue = false
...@@ -412,5 +416,6 @@ ...@@ -412,5 +416,6 @@
.fui-pv__un-ani { .fui-pv__un-ani {
transition: transform 0s; transition: transform 0s;
} }
/* #endif */ /* #endif */
</style> </style>
...@@ -36,7 +36,7 @@ proto.getModuleCount = function() { ...@@ -36,7 +36,7 @@ proto.getModuleCount = function() {
proto.make = function() { proto.make = function() {
// Calculate automatically typeNumber if provided is < 1 // Calculate automatically typeNumber if provided is < 1
if (this.typeNumber < 1 ){ if (this.typeNumber < 1 ){
var typeNumber = 1;// 功能需要优化 var typeNumber = 1;
for (typeNumber = 1; typeNumber < 40; typeNumber++) { for (typeNumber = 1; typeNumber < 40; typeNumber++) {
var rsBlocks = RSBlock.getRSBlocks(typeNumber, this.errorCorrectLevel); var rsBlocks = RSBlock.getRSBlocks(typeNumber, this.errorCorrectLevel);
...@@ -83,7 +83,7 @@ proto.makeImpl = function(test, maskPattern) { ...@@ -83,7 +83,7 @@ proto.makeImpl = function(test, maskPattern) {
if (this.typeNumber >= 7) { if (this.typeNumber >= 7) {
this.setupTypeNumber(test); this.setupTypeNumber(test);
}// 功能需要优化 }
if (this.dataCache == null) { if (this.dataCache == null) {
this.dataCache = QRCode.createData(this.typeNumber, this.errorCorrectLevel, this.dataList); this.dataCache = QRCode.createData(this.typeNumber, this.errorCorrectLevel, this.dataList);
...@@ -231,7 +231,7 @@ proto.setupTypeInfo = function(test, maskPattern) { ...@@ -231,7 +231,7 @@ proto.setupTypeInfo = function(test, maskPattern) {
var data = (this.errorCorrectLevel << 3) | maskPattern; var data = (this.errorCorrectLevel << 3) | maskPattern;
var bits = util.getBCHTypeInfo(data); var bits = util.getBCHTypeInfo(data);
// vertical// 新特性待增加 // vertical
for (var i = 0; i < 15; i++) { for (var i = 0; i < 15; i++) {
var mod = (!test && ( (bits >> i) & 1) == 1); var mod = (!test && ( (bits >> i) & 1) == 1);
...@@ -365,7 +365,7 @@ QRCode.createData = function(typeNumber, errorCorrectLevel, dataList) { ...@@ -365,7 +365,7 @@ QRCode.createData = function(typeNumber, errorCorrectLevel, dataList) {
break; break;
} }
buffer.put(QRCode.PAD1, 8); buffer.put(QRCode.PAD1, 8);
}// 功能需要优化 }
return QRCode.createBytes(buffer, rsBlocks); return QRCode.createBytes(buffer, rsBlocks);
}; };
...@@ -414,7 +414,7 @@ QRCode.createBytes = function(buffer, rsBlocks) { ...@@ -414,7 +414,7 @@ QRCode.createBytes = function(buffer, rsBlocks) {
var data = new Array(totalCodeCount); var data = new Array(totalCodeCount);
var index = 0; var index = 0;
// 功能需要优化
for (var i = 0; i < maxDcCount; i++) { for (var i = 0; i < maxDcCount; i++) {
for (var r = 0; r < rsBlocks.length; r++) { for (var r = 0; r < rsBlocks.length; r++) {
if (i < dcdata[r].length) { if (i < dcdata[r].length) {
......
<template> <template>
<!-- #ifdef APP-PLUS || H5 || MP-ALIPAY || MP-TOUTIAO --> <!-- #ifdef APP-PLUS || H5 || MP-ALIPAY || MP-TOUTIAO|| MP-KUAISHOU || MP-JD || MP-360 || MP-LARK -->
<radio-group :name="name"> <radio-group :name="name">
<slot></slot> <slot></slot>
</radio-group> </radio-group>
<!-- #endif --> <!-- #endif -->
<!-- #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ || MP-KUAISHOU || MP-JD || MP-360 || MP-LARK --> <!-- #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ -->
<fui-form-field :name="name" :value="val"> <fui-form-field :name="name" v-model="val">
<slot></slot> <slot></slot>
</fui-form-field> </fui-form-field>
<!-- #endif --> <!-- #endif -->
...@@ -16,10 +16,11 @@ ...@@ -16,10 +16,11 @@
export default { export default {
name: "fui-radio-group", name: "fui-radio-group",
emits: ['change', 'input', 'update:modelValue'], emits: ['change', 'input', 'update:modelValue'],
// #ifndef VUE3
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
behaviors: ['wx://form-field-group'], behaviors: ['wx://form-field-group'],
// #endif // #endif
// #ifdef MP-BAIDU || MP-QQ || H5
behaviors: ['uni://form-field'],
// #endif // #endif
props: { props: {
name: { name: {
...@@ -79,7 +80,7 @@ ...@@ -79,7 +80,7 @@
} }
this.radioChange(e) this.radioChange(e)
}, },
modelChange(val){ modelChange(val) {
this.childrens.forEach(item => { this.childrens.forEach(item => {
if (item.value === val) { if (item.value === val) {
item.val = true; item.val = true;
......
<template> <template>
<view class="fui-radio__input" <view class="fui-radio__input"
:class="{'fui-radio__disabled':disabled,'fui-radio__color':!color && val && !isCheckMark}" :class="{'fui-radio__disabled':disabled,'fui-radio__color':!getColor && val && !isCheckMark}"
:style="{backgroundColor:getBackgroundColor(val,isCheckMark),borderColor:getBorderColor(val,isCheckMark),zoom:isNvue?1:scaleRatio,transform:`scale(${isNvue?scaleRatio:1})`,borderRadius:borderRadius}" :style="{backgroundColor:getBackgroundColor(val,isCheckMark),borderColor:getBorderColor(val,isCheckMark),zoom:isNvue?1:scaleRatio,transform:`scale(${isNvue?scaleRatio:1})`,borderRadius:borderRadius}"
@tap.stop="radioChange"> @tap.stop="radioChange">
<view class="fui-check__mark" :style="{borderBottomColor:checkMarkColor,borderRightColor:checkMarkColor}" <view class="fui-check__mark" :style="{borderBottomColor:checkMarkColor,borderRightColor:checkMarkColor}"
v-if="val"></view> v-if="val"></view>
<radio class="fui-radio__hidden" style="opacity: 0;position: absolute;" :color="color" :disabled="disabled" :value="value" :checked="val"></radio> <radio class="fui-radio__hidden" style="opacity: 0;position: absolute;" :color="getColor" :disabled="disabled" :value="value" :checked="val"></radio>
</view> </view>
</template> </template>
...@@ -32,12 +32,7 @@ ...@@ -32,12 +32,7 @@
//radio选中背景颜色 //radio选中背景颜色
color: { color: {
type: String, type: String,
// #ifdef APP-NVUE
default: '#465CFF'
// #endif
// #ifndef APP-NVUE
default: '' default: ''
// #endif
}, },
//radio未选中时边框颜色 //radio未选中时边框颜色
borderColor: { borderColor: {
...@@ -97,6 +92,18 @@ ...@@ -97,6 +92,18 @@
} }
} }
}, },
computed: {
getColor() {
let color = this.color;
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color;
}
},
data() { data() {
let isNvue = false; let isNvue = false;
// #ifdef APP-NVUE // #ifdef APP-NVUE
...@@ -109,14 +116,14 @@ ...@@ -109,14 +116,14 @@
}, },
methods: { methods: {
getBackgroundColor(val, isCheckMark) { getBackgroundColor(val, isCheckMark) {
let color = val ? this.color : '#fff' let color = val ? this.getColor : '#fff'
if (isCheckMark) { if (isCheckMark) {
color = 'transparent' color = 'transparent'
} }
return color; return color;
}, },
getBorderColor(val, isCheckMark) { getBorderColor(val, isCheckMark) {
let color = val ? this.color : this.borderColor; let color = val ? this.getColor : this.borderColor;
if (isCheckMark) { if (isCheckMark) {
color = 'transparent' color = 'transparent'
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
v-for="(item,index) in stars" :key="index" @touchstart.stop="touchstart" @touchmove.stop="touchmove" v-for="(item,index) in stars" :key="index" @touchstart.stop="touchstart" @touchmove.stop="touchmove"
@mousedown.stop="mousedown" @mousemove.stop="mousemove" @mouseup="mouseup"> @mousedown.stop="mousedown" @mousemove.stop="mousemove" @mouseup="mouseup">
<fui-icon :disabled="disabled" :name="getName(index,intScore,decimalScore)" :size="size" <fui-icon :disabled="disabled" :name="getName(index,intScore,decimalScore)" :size="size"
:color="index < intScore || (index == intScore && decimalScore > 0) ? activeColor : color"></fui-icon> :color="index < intScore || (index == intScore && decimalScore > 0) ? getActiveColor : color"></fui-icon>
</view> </view>
</view> </view>
</template> </template>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
}, },
activeColor: { activeColor: {
type: String, type: String,
default: "#FFB703" default: ""
}, },
disabled: { disabled: {
type: Boolean, type: Boolean,
...@@ -75,10 +75,21 @@ ...@@ -75,10 +75,21 @@
this.initRateScore(newValue) this.initRateScore(newValue)
} }
}, },
computed: {
getActiveColor() {
let color = this.activeColor;
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.warning) || '#FFB703';
}
return color;
}
},
data() { data() {
return { return {
stars: [], stars: [],
pageX: 0, pageX: 0,
parentWidth: 0,
intScore: 0, intScore: 0,
decimalScore: 0, decimalScore: 0,
isPC: false, isPC: false,
...@@ -88,6 +99,7 @@ ...@@ -88,6 +99,7 @@
created() { created() {
this.initData(this.max) this.initData(this.max)
this.initRateScore(this.score) this.initRateScore(this.score)
this.drawer = this.getParent()
}, },
mounted() { mounted() {
setTimeout(() => { setTimeout(() => {
...@@ -141,6 +153,32 @@ ...@@ -141,6 +153,32 @@
return flag; return flag;
}, },
// #endif // #endif
_setWidth(width) {
const sys = uni.getSystemInfoSync()
if (this.pageX < 0) {
this.parentWidth = width
} else if (this.pageX > sys.windowWidth) {
this.parentWidth = -width
}
},
setParentWidth(width) {
setTimeout(() => {
this._setWidth(width)
}, 100)
},
initParentWidth() {
if (this.drawer) {
const sys = uni.getSystemInfoSync()
let pWidth = this.drawer.width
if (!pWidth) {
this.drawer._getSize((width) => {
this._setWidth(width)
})
} else {
this._setWidth(pWidth)
}
}
},
_getSize() { _getSize() {
// #ifndef APP-NVUE // #ifndef APP-NVUE
uni.createSelectorQuery() uni.createSelectorQuery()
...@@ -152,6 +190,7 @@ ...@@ -152,6 +190,7 @@
.exec(ret => { .exec(ret => {
if (ret) { if (ret) {
this.pageX = ret[0].left || 0 this.pageX = ret[0].left || 0
this.initParentWidth()
} }
}) })
// #endif // #endif
...@@ -160,12 +199,13 @@ ...@@ -160,12 +199,13 @@
const size = ret.size const size = ret.size
if (size) { if (size) {
this.pageX = size.left this.pageX = size.left
this.initParentWidth()
} }
}) })
// #endif // #endif
}, },
_getRateScore(clientX) { _getRateScore(clientX) {
const distance = clientX - this.pageX; const distance = clientX - (this.pageX + this.parentWidth);
let score = 0; let score = 0;
if (distance > 0) { if (distance > 0) {
let width = uni.upx2px((Number(this.size) + Number(this.spacing))); let width = uni.upx2px((Number(this.size) + Number(this.spacing)));
...@@ -237,6 +277,16 @@ ...@@ -237,6 +277,16 @@
if (!this.isPC || this.disabled || !this.touchable) return if (!this.isPC || this.disabled || !this.touchable) return
this.rated = false this.rated = false
// #endif // #endif
},
getParent(name = 'fui-drawer') {
let parent = this.$parent;
let parentName = parent.$options.name;
while (parentName !== name) {
parent = parent.$parent;
if (!parent) return false;
parentName = parent.$options.name;
}
return parent;
} }
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view class="fui-result__wrap" :style="{paddingTop:paddingTop+'rpx'}" v-if="ibColor"> <view class="fui-result__wrap" :style="{paddingTop:paddingTop+'rpx'}" v-if="ibColor">
<view class="fui-result__icon-box"> <view class="fui-result__icon-box">
<view class="fui-result__icon" <view class="fui-result__icon"
:style="{background:background,zoom:isNvue?1:scaleRatio,transform:`scale(${isNvue?scaleRatio:1})`}" :style="{background:background || getTypeColor,zoom:isNvue?1:scaleRatio,transform:`scale(${isNvue?scaleRatio:1})`}"
:class="[background?'':`fui-result__bg-${type}`]" v-if="show"> :class="[background?'':`fui-result__bg-${type}`]" v-if="show">
<view :class="['fui-result__ib-'+type]" :style="ibColor"></view> <view :class="['fui-result__ib-'+type]" :style="ibColor"></view>
<view :class="['fui-result__ia-'+type]" :style="{background:iconColor}" <view :class="['fui-result__ia-'+type]" :style="{background:iconColor}"
...@@ -100,6 +100,21 @@ ...@@ -100,6 +100,21 @@
style = `background:${this.iconColor}`; style = `background:${this.iconColor}`;
} }
return style; return style;
},
getTypeColor() {
let color = '';
// #ifdef APP-NVUE
const app = uni && uni.$fui && uni.$fui.color
let colors = {
waiting: (app && app.primary) || '#465CFF',
success: (app && app.success) || '#09BE4F',
warning: (app && app.warning) || '#FFB703',
fail: (app && app.danger) || '#FF2B2B'
}
color = colors[this.type || 'waiting']
// #endif
return color
} }
} }
} }
...@@ -138,42 +153,23 @@ ...@@ -138,42 +153,23 @@
overflow: hidden; overflow: hidden;
} }
.fui-result__bg-success {
/* #ifdef APP-NVUE */
background-color: #09BE4F !important;
/* #endif */
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
.fui-result__bg-success {
background-color: var(--fui-color-success, #09BE4F) !important; background-color: var(--fui-color-success, #09BE4F) !important;
/* #endif */
} }
.fui-result__bg-warning { .fui-result__bg-warning {
/* #ifdef APP-NVUE */
background-color: #FFB703 !important;
/* #endif */
/* #ifndef APP-NVUE */
background-color: var(--fui-color-warning, #FFB703) !important; background-color: var(--fui-color-warning, #FFB703) !important;
/* #endif */
} }
.fui-result__bg-fail { .fui-result__bg-fail {
/* #ifdef APP-NVUE */
background-color: #FF2B2B !important;
/* #endif */
/* #ifndef APP-NVUE */
background-color: var(--fui-color-danger, #FF2B2B) !important; background-color: var(--fui-color-danger, #FF2B2B) !important;
/* #endif */
} }
.fui-result__bg-waiting { .fui-result__bg-waiting {
/* #ifdef APP-NVUE */
background-color: #465CFF !important;
/* #endif */
/* #ifndef APP-NVUE */
background-color: var(--fui-color-primary, #465CFF) !important; background-color: var(--fui-color-primary, #465CFF) !important;
/* #endif */
} }
/* #endif */
.fui-result__ib-success { .fui-result__ib-success {
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<!-- #endif --> <!-- #endif -->
<view class="fui-rv__result" v-if="showRes || isPass" <view class="fui-rv__result" v-if="showRes || isPass"
:style="{ width: imgW + 'px', height:imgW + 'px',borderRadius:isNvue?(imgW+'px'):'50%' }"> :style="{ width: imgW + 'px', height:imgW + 'px',borderRadius:isNvue?(imgW+'px'):'50%' }">
<fui-icon :name="isPass?'check':'close'" :size="96" :color="isPass?passColor:failColor"></fui-icon> <fui-icon :name="isPass?'check':'close'" :size="96" :color="getColor"></fui-icon>
</view> </view>
</view> </view>
<!-- #ifdef APP-VUE || MP-WEIXIN || H5 --> <!-- #ifdef APP-VUE || MP-WEIXIN || H5 -->
...@@ -140,11 +140,11 @@ ...@@ -140,11 +140,11 @@
}, },
passColor: { passColor: {
type: String, type: String,
default: '#09BE4F' default: ''
}, },
failColor: { failColor: {
type: String, type: String,
default: '#FF2B2B' default: ''
}, },
zIndex: { zIndex: {
type: [Number, String], type: [Number, String],
...@@ -168,6 +168,14 @@ ...@@ -168,6 +168,14 @@
this.sliderWidth = this.getPx((Number(val) - 64)) this.sliderWidth = this.getPx((Number(val) - 64))
} }
}, },
computed: {
getColor() {
const app = uni && uni.$fui && uni.$fui.color;
let passColor = this.passColor || (app && app.success) || '#09BE4F'
let failColor = this.failColor || (app && app.danger) || '#FF2B2B'
return this.isPass ? passColor : failColor
}
},
data() { data() {
let isNvue = false let isNvue = false
// #ifdef APP-NVUE // #ifdef APP-NVUE
......
<template> <template>
<view class="fui-search__bar-wrap" :class="{'fui-searchbar__wrap-bg':!background}" <view class="fui-search__bar-wrap" :class="{'fui-searchbar__wrap-bg':!background}"
:style="{ background: background, paddingTop: paddingTb+'rpx',paddingBottom:paddingTb+'rpx',paddingLeft:paddingLr+'rpx',paddingRight:paddingLr+'rpx' }"> :style="{ background: background, paddingTop: paddingTb+'rpx',paddingBottom:paddingTb+'rpx',paddingLeft:paddingLr+'rpx',paddingRight:paddingLr+'rpx' }">
<slot></slot>
<view class="fui-search__bar-form" :style="{height: height+'rpx'}"> <view class="fui-search__bar-form" :style="{height: height+'rpx'}">
<view class="fui-search__bar-box" <view class="fui-search__bar-box"
:class="{'fui-searchbar__focus-invalid':!isFocus && !isSearch && showLabel && !disabled}"
:style="{ height: height+'rpx', borderRadius: radius+'rpx', background: inputBackground }" :style="{ height: height+'rpx', borderRadius: radius+'rpx', background: inputBackground }"
v-if="showInput"> v-if="showInput">
<view class="fui-search__bar-icon"> <view class="fui-search__bar-icon">
...@@ -35,7 +37,7 @@ ...@@ -35,7 +37,7 @@
<text v-if="cancel && isSearch && !val && cancelText && cancelText!=='true'" class="fui-search__bar-btn" <text v-if="cancel && isSearch && !val && cancelText && cancelText!=='true'" class="fui-search__bar-btn"
:style="{ color: cancelColor }" @tap="hideInput">{{ cancelText }}</text> :style="{ color: cancelColor }" @tap="hideInput">{{ cancelText }}</text>
<text v-if="val && !disabled && isSearch && searchText && searchText!=='true'" class="fui-search__bar-btn" <text v-if="val && !disabled && isSearch && searchText && searchText!=='true'" class="fui-search__bar-btn"
:class="{'fui-sb__btn-color':!searchColor}" :style="{ color: searchColor }" :class="{'fui-sb__btn-color':!searchColor}" :style="{ color: getSearchColor }"
@tap="search">{{ searchText }}</text> @tap="search">{{ searchText }}</text>
</view> </view>
</template> </template>
...@@ -124,12 +126,7 @@ ...@@ -124,12 +126,7 @@
}, },
searchColor: { searchColor: {
type: String, type: String,
// #ifdef APP-NVUE
default: '#465CFF'
// #endif
// #ifndef APP-NVUE
default: '' default: ''
// #endif
}, },
//是否显示搜索输入框 //是否显示搜索输入框
showInput: { showInput: {
...@@ -171,7 +168,7 @@ ...@@ -171,7 +168,7 @@
// #ifdef APP-NVUE // #ifdef APP-NVUE
isFocus(val) { isFocus(val) {
if (!this.$refs.searchBarRef) return; if (!this.$refs.searchBarRef) return;
this.$nextTick(()=>{ this.$nextTick(() => {
setTimeout(() => { setTimeout(() => {
if (val) { if (val) {
this.$refs.searchBarRef.focus() this.$refs.searchBarRef.focus()
...@@ -182,6 +179,21 @@ ...@@ -182,6 +179,21 @@
// #endif // #endif
value(val) { value(val) {
this.val = val; this.val = val;
if (this.focus || this.val.length > 0) {
this.isSearch = true;
}
}
},
computed: {
getSearchColor() {
let color = this.searchColor
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color
} }
}, },
data() { data() {
...@@ -207,6 +219,10 @@ ...@@ -207,6 +219,10 @@
inputFocus(e) { inputFocus(e) {
if (!this.showLabel) { if (!this.showLabel) {
this.isSearch = true this.isSearch = true
} else {
// #ifdef H5 || MP-ALIPAY
this.onShowInput()
// #endif
} }
this.$emit('focus', e); this.$emit('focus', e);
}, },
...@@ -220,9 +236,11 @@ ...@@ -220,9 +236,11 @@
onShowInput() { onShowInput() {
if (!this.disabled && this.showInput) { if (!this.disabled && this.showInput) {
this.isSearch = true; this.isSearch = true;
this.$nextTick(() => {
setTimeout(() => { setTimeout(() => {
this.isFocus = true; this.isFocus = true;
}, 20) }, 50)
})
} }
this.$emit('click', {}); this.$emit('click', {});
}, },
...@@ -294,8 +312,20 @@ ...@@ -294,8 +312,20 @@
flex-direction: row; flex-direction: row;
z-index: 1; z-index: 1;
align-items: center; align-items: center;
/* #ifdef H5 || MP-ALIPAY */
opacity: 1;
/* #endif */
} }
/* #ifdef H5 || MP-ALIPAY */
.fui-searchbar__focus-invalid {
position: relative;
opacity: 0;
z-index: 3;
}
/* #endif */
.fui-search__bar-input { .fui-search__bar-input {
padding: 0 16rpx; padding: 0 16rpx;
border: 0; border: 0;
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
<view class="fui-segmented__control" :class="{'fui-segmented__disabled':disabled}" <view class="fui-segmented__control" :class="{'fui-segmented__disabled':disabled}"
:style="{marginTop:marginTop+'rpx',marginBottom:marginBottom+'rpx'}"> :style="{marginTop:marginTop+'rpx',marginBottom:marginBottom+'rpx'}">
<view class="fui-segmented__item" v-for="(item,index) in vals" :key="index" <view class="fui-segmented__item" v-for="(item,index) in vals" :key="index"
:style="{borderTopLeftRadius:index===0?radius+'rpx':'0',borderBottomLeftRadius:index===0?radius+'rpx':'0',borderTopRightRadius:index===values.length - 1?radius+'rpx':'0',borderBottomRightRadius:index===values.length - 1?radius+'rpx':'0',borderColor:type==='button'?color:'transparent',background:currentIndex===index && type==='button'?color:'transparent',height:height+'rpx'}" :style="{borderTopLeftRadius:index===0?radius+'rpx':'0',borderBottomLeftRadius:index===0?radius+'rpx':'0',borderTopRightRadius:index===values.length - 1?radius+'rpx':'0',borderBottomRightRadius:index===values.length - 1?radius+'rpx':'0',borderColor:type==='button'?getColor:'transparent',background:currentIndex===index && type==='button'?getColor:'transparent',height:height+'rpx'}"
:class="{'fui-segmented__first':index===0 && type==='button','fui-seg__item-bg':currentIndex===index && !color && type==='button','fui-seg__item-border':!color && type==='button','fui-segmented__item-border':type==='button'}" :class="{'fui-segmented__first':index===0 && type==='button','fui-seg__item-bg':currentIndex===index && !color && type==='button','fui-seg__item-border':!color && type==='button','fui-segmented__item-border':type==='button'}"
@click="handleClick(index)"> @click="handleClick(index)">
<text <text
:style="{fontSize:size+'rpx',color:currentIndex===index?activeColor:color,fontWeight:bold && currentIndex===index ?600:400}" :style="{fontSize:size+'rpx',color:currentIndex===index?activeColor:getColor,fontWeight:bold && currentIndex===index ?600:400}"
:class="{'fui-segmented__disabled':item.disabled,'fui-seg__text-color':!color && currentIndex!==index}">{{item.name}}</text> :class="{'fui-segmented__disabled':item.disabled,'fui-seg__text-color':!color && currentIndex!==index}">{{item.name}}</text>
<view class="fui-segmented__item-line" v-if="currentIndex===index && type==='text'" <view class="fui-segmented__item-line" v-if="currentIndex===index && type==='text'"
:style="{background:activeColor}"></view> :style="{background:activeColor}"></view>
...@@ -36,13 +36,7 @@ ...@@ -36,13 +36,7 @@
}, },
color: { color: {
type: String, type: String,
// #ifdef APP-NVUE
default: '#465CFF'
// #endif
// #ifndef APP-NVUE
default: '' default: ''
// #endif
}, },
activeColor: { activeColor: {
type: String, type: String,
...@@ -77,6 +71,18 @@ ...@@ -77,6 +71,18 @@
default: 0 default: 0
} }
}, },
computed:{
getColor(){
let color = this.color
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color
}
},
data() { data() {
return { return {
currentIndex: 0, currentIndex: 0,
......
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
<view class="fui-select__item" <view class="fui-select__item"
:class="{'fui-select__reverse':isReverse && type==='select','fui-sitem__disable':model.disabled}"> :class="{'fui-select__reverse':isReverse && type==='select','fui-sitem__disable':model.disabled}">
<view class="fui-select__checkbox" <view class="fui-select__checkbox"
:class="{'fui-select__is-checkmark ':isCheckMark,'fui-select__checkbox-color':(!checkboxColor || checkboxColor=='true') && model.checked && !isCheckMark}" :class="{'fui-select__is-checkmark ':isCheckMark,'fui-select__checkbox-color':(!checkboxColor || checkboxColor===true) && model.checked && !isCheckMark}"
:style="{background:model.checked && !isCheckMark ?checkboxColor:'transparent',borderColor:model.checked && !isCheckMark ?checkboxColor:borderColor}" :style="{background:model.checked && !isCheckMark ?getCheckboxColor:'transparent',borderColor:model.checked && !isCheckMark ?getCheckboxColor:borderColor}"
v-if="type==='select'"> v-if="type==='select'">
<view class="fui-select__checkmark" <view class="fui-select__checkmark"
:style="{borderBottomColor:checkmarkColor,borderRightColor:checkmarkColor}" :style="{borderBottomColor:checkmarkColor,borderRightColor:checkmarkColor}"
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
</scroll-view> </scroll-view>
<view class="fui-select__btn-wrap" v-if="type==='select'"> <view class="fui-select__btn-wrap" v-if="type==='select'">
<view class="fui-select__btn" :class="{'fui-select__btn-color':!btnBackground}" <view class="fui-select__btn" :class="{'fui-select__btn-color':!btnBackground}"
:style="{background:btnBackground}"> :style="{background:getBgColor}">
<text class="fui-select__btn" :class="['fui-select__btn-text']" :style="{color:btnColor}" <text class="fui-select__btn" :class="['fui-select__btn-text']" :style="{color:btnColor}"
@tap.stop="handleClick">{{btnText}}</text> @tap.stop="handleClick">{{btnText}}</text>
</view> </view>
...@@ -132,18 +132,10 @@ ...@@ -132,18 +132,10 @@
} }
}, },
//选择框选中后颜色 //选择框选中后颜色
// #ifndef APP-NVUE
checkboxColor: { checkboxColor: {
type: String, type: String,
default: '' default: ''
}, },
// #endif
// #ifdef APP-NVUE
checkboxColor: {
type: String,
default: '#465CFF'
},
// #endif
borderColor: { borderColor: {
type: String, type: String,
default: '#ccc' default: '#ccc'
...@@ -204,18 +196,10 @@ ...@@ -204,18 +196,10 @@
type: String, type: String,
default: '确定' default: '确定'
}, },
// #ifdef APP-NVUE
btnBackground: {
type: String,
default: '#465CFF'
},
// #endif
// #ifndef APP-NVUE
btnBackground: { btnBackground: {
type: String, type: String,
default: '' default: ''
}, },
// #endif
btnColor: { btnColor: {
type: String, type: String,
default: '#fff' default: '#fff'
...@@ -241,6 +225,26 @@ ...@@ -241,6 +225,26 @@
computed: { computed: {
getStyles() { getStyles() {
return `background:${this.maskBackground};z-index:${Number(this.zIndex)-1};` return `background:${this.maskBackground};z-index:${Number(this.zIndex)-1};`
},
getCheckboxColor() {
let color = this.checkboxColor
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color
},
getBgColor() {
let color = this.btnBackground
// #ifdef APP-NVUE
if (!color || color === true) {
const app = uni && uni.$fui && uni.$fui.color;
color = (app && app.primary) || '#465CFF';
}
// #endif
return color
} }
}, },
watch: { watch: {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论