提交 755cf672 编写于 作者: DCloud_JSON's avatar DCloud_JSON 提交者: study夏羽

解决首页为非nvue页面时白屏的问题。 -...

解决首页为非nvue页面时白屏的问题。 - 注意:本次在中修改了路由拦截的逻辑,是个兼容方案;当首页为非nvue页面,路由拦截器逻辑会在加载首页时执行。接下来新版本的hx编译的uni-app项目无论首页是否为nvue都不走拦截器,保持各端逻辑一致。
上级 13e686ab
<script> <script>
import initApp from '@/common/appInit.js'; import initApp from '@/common/appInit.js';
import checkIsAgree from '@/uni_modules/uni-agree/utils/uni-agree.js'; import checkIsAgree from '@/uni_modules/uni-agree/utils/uni-agree.js';
export default { export default {
globalData: { globalData: {
searchText: '', searchText: '',
appVersion: {}, appVersion: {},
config: {} config: {}
}, },
onLaunch: function() { onLaunch: function() {
console.log('App Launch') console.log('App Launch')
initApp(); initApp();
// #ifdef APP-PLUS // #ifdef APP-PLUS
......
## 1.0.44(2021-08-05)
解决首页为非nvue页面时白屏的问题。
- 注意:本次在`common/appInit.js`中修改了路由拦截的逻辑,是个兼容方案;当首页为非nvue页面,路由拦截器逻辑会在加载首页时执行。接下来新版本的hx编译的uni-app项目无论首页是否为nvue都不走拦截器,保持各端逻辑一致。
## 1.0.43(2021-08-02) ## 1.0.43(2021-08-02)
1. 微信小程序端,新增:微信登陆成功后,弹出是否"获取微信头像和昵称,完善个人资料"的弹框 1. 微信小程序端,新增:微信登陆成功后,弹出是否"获取微信头像和昵称,完善个人资料"的弹框
2. APP端,新增逻辑:微信登陆成功后,自动获取用户的微信昵称和头像完善用户个人资料 2. APP端,新增逻辑:微信登陆成功后,自动获取用户的微信昵称和头像完善用户个人资料
......
...@@ -56,7 +56,7 @@ export default async function() { ...@@ -56,7 +56,7 @@ export default async function() {
uniStarterConfig.router.login = loginConfig uniStarterConfig.router.login = loginConfig
// uniStarterConfig挂载到getApp().globalData.config // uniStarterConfig挂载到getApp().globalData.config
setTimeout(() => { setTimeout(() => {
getApp({ getApp({
allowDefault: true allowDefault: true
}).globalData.config = uniStarterConfig; }).globalData.config = uniStarterConfig;
...@@ -309,12 +309,14 @@ export default async function() { ...@@ -309,12 +309,14 @@ export default async function() {
//token是否已失效 //token是否已失效
tokenExpired = uni.getStorageSync('uni_id_token_expired') < Date.now(), tokenExpired = uni.getStorageSync('uni_id_token_expired') < Date.now(),
//获取要跳转的页面路径(url去掉"?"和"?"后的参数) //获取要跳转的页面路径(url去掉"?"和"?"后的参数)
url = e.url.split('?')[0], url = e.url.split('?')[0];
//获取要前往的页面路径(即url去掉"?"和"?"后的参数) //获取要前往的页面路径(即url去掉"?"和"?"后的参数)
pages = getCurrentPages(), const pages = getCurrentPages();
fromUrl = pages[pages.length - 1].route; if(!pages.length){
return e
}
const fromUrl = pages[pages.length - 1].route;
let inLoginPage = fromUrl.split('/')[2] == 'login-page' let inLoginPage = fromUrl.split('/')[2] == 'login-page'
//控制登录优先级 //控制登录优先级
...@@ -430,6 +432,5 @@ function initAppVersion() { ...@@ -430,6 +432,5 @@ function initAppVersion() {
}) })
}); });
// 检查更新 // 检查更新
checkUpdate();
// #endif // #endif
} }
...@@ -66,6 +66,9 @@ ...@@ -66,6 +66,9 @@
} }
callBack() callBack()
}, },
fail: (err) => {
console.error(err)
},
complete: (e) => { complete: (e) => {
// console.log("downloadFile",e); // console.log("downloadFile",e);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
<title></title> <title></title>
<!--preload-links--> <!--preload-links-->
<!--app-context--> <!--app-context-->
...@@ -11,4 +11,4 @@ ...@@ -11,4 +11,4 @@
<div id="app"><!--app-html--></div> <div id="app"><!--app-html--></div>
<script type="module" src="/main.js"></script> <script type="module" src="/main.js"></script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"nvueStyleCompiler": "uni-app", "nvueStyleCompiler": "uni-app",
"compilerVersion": 3, "compilerVersion": 3,
"splashscreen": { "splashscreen": {
"alwaysShowBeforeRender": true, "alwaysShowBeforeRender": false,
"waiting": true, "waiting": true,
"autoclose": true, "autoclose": true,
"delay": 0 "delay": 0
......
{ {
"id": "uni-starter", "id": "uni-starter",
"displayName": "uni-starter", "displayName": "uni-starter",
"version": "1.0.43", "version": "1.0.44",
"description": "云端一体应用快速开发基本项目模版", "description": "云端一体应用快速开发基本项目模版",
"keywords": [ "keywords": [
"login", "login",
......
{ {
"pages": [{ "pages": [
{
"path": "pages/list/list", "path": "pages/list/list",
"style": { "style": {
"navigationStyle": "custom", "navigationStyle": "custom",
"enablePullDownRefresh": true "enablePullDownRefresh": true
} }
}, },
{ {
"path": "pages/grid/grid", "path": "pages/grid/grid",
"style": { "style": {
...@@ -42,7 +43,6 @@ ...@@ -42,7 +43,6 @@
}, },
"h5": { "h5": {
"titleNView": { "titleNView": {
"buttons": [],
"type": "transparent" "type": "transparent"
} }
}, },
...@@ -174,6 +174,8 @@ ...@@ -174,6 +174,8 @@
}, },
"condition": { "condition": {
"list": [{ "list": [{
"path": "pages/list/detail"
},{
"path": "pages/list/list" "path": "pages/list/list"
}, },
{ {
...@@ -185,7 +187,7 @@ ...@@ -185,7 +187,7 @@
"path": "pages/ucenter/settings/settings" "path": "pages/ucenter/settings/settings"
} }
], ],
"current": 0 "current": 1
}, },
"tabBar": { "tabBar": {
"color": "#7A7E83", "color": "#7A7E83",
......
...@@ -81,7 +81,9 @@ ...@@ -81,7 +81,9 @@
return getApp().globalData.config return getApp().globalData.config
} }
}, },
onLoad(event) { onLoad(event) {
console.log(event);
event = {"id":"60783c5cb781700001375672","title":"阿里小程序IDE官方内嵌uni-app,为开发者提供多端开发服务","excerpt":"阿里小程序IDE官方内嵌uni-app,为开发者提供多端开发服务","avatar":"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-aliyun-gacrhzeynhss7c6d04/249516a0-3941-11eb-899d-733ae62bed2f.jpg"}
//获取真实新闻id,通常 id 来自上一个页面 //获取真实新闻id,通常 id 来自上一个页面
if (event.id) { if (event.id) {
this.id = event.id this.id = event.id
...@@ -94,7 +96,7 @@ ...@@ -94,7 +96,7 @@
}) })
} }
}, },
onNavigationBarButtonTap(event) { onNavigationBarButtonTap(event) {
if (event.type == 'share') { if (event.type == 'share') {
this.shareClick(); this.shareClick();
} }
...@@ -183,7 +185,13 @@ ...@@ -183,7 +185,13 @@
title, title,
excerpt, excerpt,
avatar avatar
} = this.$refs.detail.dataList } = this.$refs.detail.dataList
console.log( JSON.stringify({
_id,
title,
excerpt,
avatar
}) );
uniShare({ uniShare({
content: { //公共的分享类型(type)、链接(herf)、标题(title)、summary(描述)、imageUrl(缩略图) content: { //公共的分享类型(type)、链接(herf)、标题(title)、summary(描述)、imageUrl(缩略图)
type: 0, type: 0,
...@@ -251,7 +259,7 @@ ...@@ -251,7 +259,7 @@
], ],
cancelText: "取消分享", cancelText: "取消分享",
}, e => { //callback }, e => { //callback
console.log(e); // console.log(e);
}) })
}, },
} }
......
<template> <template>
<view class="pages"> <view class="pages">
<!-- #ifndef H5 --> <!-- #ifndef H5 -->
<statusBar></statusBar> <statusBar></statusBar>
<!-- #endif --> <!-- #endif -->
<!-- 搜索功能 --> <!-- 搜索功能 -->
<view @click.capture="searchClick"> <view @click.capture="searchClick">
...@@ -132,7 +132,14 @@ ...@@ -132,7 +132,14 @@
} }
</script> </script>
<style scoped> <style scoped>
/* #ifndef APP-NVUE */
view {
display: flex;
box-sizing: border-box;
flex-direction: column;
}
/* #endif */
.pages { .pages {
background-color: #FFFFFF; background-color: #FFFFFF;
} }
......
...@@ -129,7 +129,6 @@ ...@@ -129,7 +129,6 @@
box-sizing: border-box; box-sizing: border-box;
flex-direction: column; flex-direction: column;
} }
/* #endif */ /* #endif */
.about { .about {
width: 750upx; width: 750upx;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<uni-icons class="icon" color="#007AFF" :type="item.icon" size="26"></uni-icons> <uni-icons class="icon" color="#007AFF" :type="item.icon" size="26"></uni-icons>
<text class="text">{{item.text}}</text> <text class="text">{{item.text}}</text>
</uni-grid-item> </uni-grid-item>
</uni-grid> </uni-grid>
<uni-list class="center-list" v-for="(sublist , index) in ucenterList" :key="index"> <uni-list class="center-list" v-for="(sublist , index) in ucenterList" :key="index">
<uni-list-item v-for="(item,i) in sublist" :title="item.title" link :rightText="item.rightText" :key="i" <uni-list-item v-for="(item,i) in sublist" :title="item.title" link :rightText="item.rightText" :key="i"
:clickable="true" :to="item.to" @click="ucenterListClick(item)" :show-extra-icon="true" :clickable="true" :to="item.to" @click="ucenterListClick(item)" :show-extra-icon="true"
...@@ -129,7 +129,7 @@ ...@@ -129,7 +129,7 @@
icon: 'loop', icon: 'loop',
showBadge: this.appVersion.hasNew showBadge: this.appVersion.hasNew
}) })
//#endif //#endif
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
...@@ -231,6 +231,8 @@ ...@@ -231,6 +231,8 @@
title: msg, title: msg,
icon: 'none' icon: 'none'
}); });
}).finally(()=>{
uni.hideLoading()
}) })
}, },
async share() { async share() {
...@@ -318,13 +320,12 @@ ...@@ -318,13 +320,12 @@
view { view {
display: flex; display: flex;
box-sizing: border-box; box-sizing: border-box;
flex-direction: column; flex-direction: column;
} }
page { page {
background-color: #f8f8f8; background-color: #f8f8f8;
} }
/* #endif*/ /* #endif*/
.center { .center {
......
...@@ -38,7 +38,7 @@ export default { ...@@ -38,7 +38,7 @@ export default {
{"pattern":/^\/pages\/list.*/}, //支持正则表达式 {"pattern":/^\/pages\/list.*/}, //支持正则表达式
"/pages/grid/grid", "/pages/grid/grid",
"/pages/ucenter/ucenter", "/pages/ucenter/ucenter",
"/pages/ucenter/about/about", "/pages/ucenter/about/about"
], ],
/* /*
login:配置登陆类型与优先级 login:配置登陆类型与优先级
......
...@@ -264,7 +264,7 @@ function checkSystemEnableLocation() { ...@@ -264,7 +264,7 @@ function checkSystemEnableLocation() {
} }
} }
module.exports = { export default {
judgeIosPermission: judgeIosPermission, judgeIosPermission: judgeIosPermission,
requestAndroidPermission: requestAndroidPermission, requestAndroidPermission: requestAndroidPermission,
checkSystemEnableLocation: checkSystemEnableLocation, checkSystemEnableLocation: checkSystemEnableLocation,
......
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
</template> </template>
<script> <script>
import {about} from '@/uni-starter.config.js'; import config from '@/uni-starter.config.js';
const { about } = config
export default { export default {
data() { data() {
return { return {
......
## 1.1.4(2021-07-29) ## 1.1.5(2021-07-30)
- 修复 去掉 nvue 不支持css 的 align-self 属性,nvue 下不暂支持 absolute 属性 - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.1.3(2021-06-24) ## 1.1.4
- 优化 示例项目 - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.1.1(2021-05-12) ## 1.1.3(2021-06-24)
- 新增 组件示例地址 - 优化 示例项目
## 1.1.0(2021-05-12) ## 1.1.1(2021-05-12)
- 新增 uni-badge 的 absolute 属性,支持定位 - 新增 组件示例地址
- 新增 uni-badge 的 offset 属性,支持定位偏移 ## 1.1.0(2021-05-12)
- 新增 uni-badge 的 is-dot 属性,支持仅显示有一个小点 - 新增 uni-badge 的 absolute 属性,支持定位
- 新增 uni-badge 的 max-num 属性,支持自定义封顶的数字值,超过 99 显示99+ - 新增 uni-badge 的 offset 属性,支持定位偏移
- 优化 uni-badge 属性 custom-style, 支持以对象形式自定义样式 - 新增 uni-badge 的 is-dot 属性,支持仅显示有一个小点
## 1.0.7(2021-05-07) - 新增 uni-badge 的 max-num 属性,支持自定义封顶的数字值,超过 99 显示99+
- 修复 uni-badge 在 App 端,数字小于10时不是圆形的bug - 优化 uni-badge 属性 custom-style, 支持以对象形式自定义样式
- 修复 uni-badge 在父元素不是 flex 布局时,宽度缩小的bug ## 1.0.7(2021-05-07)
- 新增 uni-badge 属性 custom-style, 支持自定义样式 - 修复 uni-badge 在 App 端,数字小于10时不是圆形的bug
## 1.0.6(2021-02-04) - 修复 uni-badge 在父元素不是 flex 布局时,宽度缩小的bug
- 调整为uni_modules目录规范 - 新增 uni-badge 属性 custom-style, 支持自定义样式
## 1.0.6(2021-02-04)
- 调整为uni_modules目录规范
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
*/ */
export default { export default {
name: 'UniBadge', name: 'UniBadge',
emits:['click'],
props: { props: {
type: { type: {
type: String, type: String,
......
{ {
"id": "uni-badge", "id": "uni-badge",
"displayName": "uni-badge 数字角标", "displayName": "uni-badge 数字角标",
"version": "1.1.4", "version": "1.1.5",
"description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。", "description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。",
"keywords": [ "keywords": [
"", "",
"badge", "badge",
"uni-ui", "uni-ui",
"uniui", "uniui",
"数字角标", "数字角标",
"徽章" "徽章"
], ],
"repository": "https://github.com/dcloudio/uni-ui", "repository": "https://github.com/dcloudio/uni-ui",
"engines": { "engines": {
"HBuilderX": "" "HBuilderX": ""
}, },
"directories": { "directories": {
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [ "category": [
"前端组件", "前端组件",
"通用组件" "通用组件"
], ],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
}, },
"sourcecode": { "sourcecode": {
"price": "0.00" "price": "0.00"
} }
}, },
"contact": { "contact": {
"qq": "" "qq": ""
}, },
"declaration": { "declaration": {
"ads": "无", "ads": "无",
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [], "dependencies": [],
"encrypt": [], "encrypt": [],
"platforms": { "platforms": {
"cloud": { "cloud": {
"tcb": "y", "tcb": "y",
"aliyun": "y" "aliyun": "y"
}, },
"client": { "client": {
"App": { "App": {
"app-vue": "y", "app-vue": "y",
"app-nvue": "y" "app-nvue": "y"
}, },
"H5-mobile": { "H5-mobile": {
"Safari": "y", "Safari": "y",
"Android Browser": "y", "Android Browser": "y",
"微信浏览器(Android)": "y", "微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y" "QQ浏览器(Android)": "y"
}, },
"H5-pc": { "H5-pc": {
"Chrome": "y", "Chrome": "y",
"IE": "y", "IE": "y",
"Edge": "y", "Edge": "y",
"Firefox": "y", "Firefox": "y",
"Safari": "y" "Safari": "y"
}, },
"小程序": { "小程序": {
"微信": "y", "微信": "y",
"阿里": "y", "阿里": "y",
"百度": "y", "百度": "y",
"字节跳动": "y", "字节跳动": "y",
"QQ": "y" "QQ": "y"
}, },
"快应用": { "快应用": {
"华为": "y", "华为": "y",
"联盟": "y" "联盟": "y"
} }
} }
} }
} }
} }
\ No newline at end of file
## 1.3.16(2021-05-12) ## 1.4.0(2021-07-30)
- 新增 组件示例地址 - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.3.16(2021-05-12)
- 新增 组件示例地址
## 1.3.15(2021-02-04) ## 1.3.15(2021-02-04)
- 调整为uni_modules目录规范 - 调整为uni_modules目录规范
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
<script> <script>
export default { export default {
emits:['change'],
props: { props: {
weeks: { weeks: {
type: Object, type: Object,
......
...@@ -87,6 +87,7 @@ ...@@ -87,6 +87,7 @@
components: { components: {
calendarItem calendarItem
}, },
emits:['close','confirm','change','monthSwitch'],
props: { props: {
date: { date: {
type: String, type: String,
......
{ {
"id": "uni-calendar", "id": "uni-calendar",
"displayName": "uni-calendar 日历", "displayName": "uni-calendar 日历",
"version": "1.3.16", "version": "1.4.0",
"description": "日历组件", "description": "日历组件",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
......
## 1.2.0(2021-07-13) ## 1.2.1(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 优化 vue3下事件警告的问题
## 1.2.0(2021-07-13)
- 组件兼容 vue3,如何创建vue3项目详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.1.8(2021-07-01) ## 1.1.8(2021-07-01)
- 优化 图文卡片无图片加载时,提供占位图标 - 优化 图文卡片无图片加载时,提供占位图标
- 新增 header 插槽,自定义卡片头部( 图文卡片 mode="style" 时,不支持) - 新增 header 插槽,自定义卡片头部( 图文卡片 mode="style" 时,不支持)
......
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
*/ */
export default { export default {
name: 'UniCard', name: 'UniCard',
emits:['click'],
props: { props: {
title: { title: {
type: String, type: String,
......
{ {
"id": "uni-card", "id": "uni-card",
"displayName": "uni-card 卡片", "displayName": "uni-card 卡片",
"version": "1.2.0", "version": "1.2.1",
"description": "Card 组件,提供常见的卡片样式。", "description": "Card 组件,提供常见的卡片样式。",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
......
## 1.2.2(2021-07-21) ## 1.3.1(2021-07-30)
- 修复 由1.2.0版本引起的 change 事件返回 undefined 的Bug - 优化 vue3下小程序事件警告的问题
## 1.2.1(2021-07-21) ## 1.3.0(2021-07-30)
- 优化 组件示例 - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.2.0(2021-07-21) ## 1.2.2(2021-07-21)
- 新增 组件折叠动画 - 修复 由1.2.0版本引起的 change 事件返回 undefined 的Bug
- 新增 value\v-model 属性 ,动态修改面板折叠状态 ## 1.2.1(2021-07-21)
- 新增 title 插槽 ,可定义面板标题 - 优化 组件示例
- 新增 border 属性 ,显示隐藏面板内容分隔线 ## 1.2.0(2021-07-21)
- 新增 title-border 属性 ,显示隐藏面板标题分隔线 - 新增 组件折叠动画
- 修复 resize 方法失效的Bug - 新增 value\v-model 属性 ,动态修改面板折叠状态
- 修复 change 事件返回参数不正确的Bug - 新增 title 插槽 ,可定义面板标题
- 优化 H5、App 平台自动更具内容更新高度,无需调用 reszie() 方法 - 新增 border 属性 ,显示隐藏面板内容分隔线
- 新增 title-border 属性 ,显示隐藏面板标题分隔线
- 修复 resize 方法失效的Bug
- 修复 change 事件返回参数不正确的Bug
- 优化 H5、App 平台自动更具内容更新高度,无需调用 reszie() 方法
## 1.1.7(2021-05-12) ## 1.1.7(2021-05-12)
- 新增 组件示例地址 - 新增 组件示例地址
## 1.1.6(2021-02-05) ## 1.1.6(2021-02-05)
......
...@@ -119,16 +119,21 @@ ...@@ -119,16 +119,21 @@
this.collapse = this.getCollapse() this.collapse = this.getCollapse()
this.oldHeight = 0 this.oldHeight = 0
}, },
// #ifndef VUE3
// TODO vue2 // TODO vue2
destroyed() { destroyed() {
if (this.__isUnmounted) return if (this.__isUnmounted) return
this.uninstall() this.uninstall()
}, },
// #endif
// #ifdef VUE3
// TODO vue3 // TODO vue3
unmounted() { unmounted() {
this.__isUnmounted = true this.__isUnmounted = true
this.uninstall() this.uninstall()
}, },
// #endif
mounted() { mounted() {
if (!this.collapse) return if (!this.collapse) return
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*/ */
export default { export default {
name: 'uniCollapse', name: 'uniCollapse',
emits:['change','activeItem','input','update:modelValue'],
props: { props: {
value: { value: {
type: [String, Array], type: [String, Array],
......
{ {
"id": "uni-collapse", "id": "uni-collapse",
"displayName": "uni-collapse 折叠面板", "displayName": "uni-collapse 折叠面板",
"version": "1.2.2", "version": "1.3.1",
"description": "Collapse 组件,可以折叠 / 展开的内容区域。", "description": "Collapse 组件,可以折叠 / 展开的内容区域。",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
......
...@@ -265,10 +265,10 @@ export default { ...@@ -265,10 +265,10 @@ export default {
### Collapse Slots ### Collapse Slots
| 插槽名 | 说明 | |插槽名|说明|
| :-: | :-: | |:-:| :-:|
| default |默认插槽| |default|默认插槽|
| title |面板标题插槽,如使用此插槽禁用样式效果将失效| |title|面板标题插槽,如使用此插槽禁用样式效果将失效|
## 组件示例 ## 组件示例
......
## 0.0.6(2021-05-12) ## 0.1.0(2021-07-30)
- 新增 组件示例地址 - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 0.0.6(2021-05-12)
- 新增 组件示例地址
## 0.0.5(2021-04-21) ## 0.0.5(2021-04-21)
- 优化 添加依赖 uni-icons, 导入后自动下载依赖 - 优化 添加依赖 uni-icons, 导入后自动下载依赖
## 0.0.4(2021-02-05) ## 0.0.4(2021-02-05)
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
*/ */
export default { export default {
name: 'uniCombox', name: 'uniCombox',
emits:['input','update:modelValue'],
props: { props: {
label: { label: {
type: String, type: String,
...@@ -58,10 +59,18 @@ ...@@ -58,10 +59,18 @@
type: String, type: String,
default: '无匹配项' default: '无匹配项'
}, },
// #ifndef VUE3
value: { value: {
type: [String, Number], type: [String, Number],
default: '' default: ''
} },
// #endif
// #ifdef VUE3
modelValue: {
type: [String, Number],
default: ''
},
// #endif
}, },
data() { data() {
return { return {
...@@ -88,12 +97,22 @@ ...@@ -88,12 +97,22 @@
} }
}, },
watch: { watch: {
// #ifndef VUE3
value: { value: {
handler(newVal) { handler(newVal) {
this.inputVal = newVal this.inputVal = newVal
}, },
immediate: true immediate: true
} },
// #endif
// #ifdef VUE3
modelValue: {
handler(newVal) {
this.inputVal = newVal
},
immediate: true
},
// #endif
}, },
methods: { methods: {
toggleSelector() { toggleSelector() {
...@@ -111,10 +130,12 @@ ...@@ -111,10 +130,12 @@
this.inputVal = this.filterCandidates[index] this.inputVal = this.filterCandidates[index]
this.showSelector = false this.showSelector = false
this.$emit('input', this.inputVal) this.$emit('input', this.inputVal)
this.$emit('update:modelValue', this.inputVal)
}, },
onInput() { onInput() {
setTimeout(() => { setTimeout(() => {
this.$emit('input', this.inputVal) this.$emit('input', this.inputVal)
this.$emit('update:modelValue', this.inputVal)
}) })
} }
} }
......
{ {
"id": "uni-combox", "id": "uni-combox",
"displayName": "uni-combox 组合框", "displayName": "uni-combox 组合框",
"version": "0.0.6", "version": "0.1.0",
"description": "可以选择也可以输入的表单项 ", "description": "可以选择也可以输入的表单项 ",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
......
## 1.0.5(2021-06-18) ## 1.1.1(2021-07-30)
- 修复 uni-countdown 重复赋值跳两秒的 bug - 优化 vue3下小程序事件警告的问题
## 1.0.4(2021-05-12) ## 1.1.0(2021-07-30)
- 新增 组件示例地址 - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.0.3(2021-05-08) ## 1.0.5(2021-06-18)
- 修复 uni-countdown 不能控制倒计时的 bug - 修复 uni-countdown 重复赋值跳两秒的 bug
## 1.0.2(2021-02-04) ## 1.0.4(2021-05-12)
- 调整为uni_modules目录规范 - 新增 组件示例地址
## 1.0.3(2021-05-08)
- 修复 uni-countdown 不能控制倒计时的 bug
## 1.0.2(2021-02-04)
- 调整为uni_modules目录规范
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
*/ */
export default { export default {
name: 'UniCountdown', name: 'UniCountdown',
emits:['timeup'],
props: { props: {
showDay: { showDay: {
type: Boolean, type: Boolean,
...@@ -126,9 +127,16 @@ ...@@ -126,9 +127,16 @@
this.seconds = this.toSeconds(this.timestamp, this.day, this.hour, this.minute, this.second) this.seconds = this.toSeconds(this.timestamp, this.day, this.hour, this.minute, this.second)
this.countDown() this.countDown()
}, },
beforeDestroy() { // #ifndef VUE3
destroyed() {
clearInterval(this.timer) clearInterval(this.timer)
}, },
// #endif
// #ifdef VUE3
unmounted() {
clearInterval(this.timer)
},
// #endif
methods: { methods: {
toSeconds(timestamp, day, hours, minutes, seconds) { toSeconds(timestamp, day, hours, minutes, seconds) {
if (timestamp) { if (timestamp) {
......
{ {
"id": "uni-countdown", "id": "uni-countdown",
"displayName": "uni-countdown 倒计时", "displayName": "uni-countdown 倒计时",
"version": "1.0.5", "version": "1.1.1",
"description": "CountDown 倒计时组件", "description": "CountDown 倒计时组件",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
"uniui", "uniui",
"countdown", "countdown",
"倒计时" "倒计时"
], ],
"repository": "https://github.com/dcloudio/uni-ui", "repository": "https://github.com/dcloudio/uni-ui",
"engines": { "engines": {
"HBuilderX": "" "HBuilderX": ""
}, },
"directories": { "directories": {
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [ "category": [
"前端组件", "前端组件",
"通用组件" "通用组件"
], ],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
}, },
"sourcecode": { "sourcecode": {
"price": "0.00" "price": "0.00"
} }
}, },
"contact": { "contact": {
"qq": "" "qq": ""
}, },
"declaration": { "declaration": {
"ads": "无", "ads": "无",
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [], "dependencies": [],
"encrypt": [], "encrypt": [],
"platforms": { "platforms": {
"cloud": { "cloud": {
"tcb": "y", "tcb": "y",
"aliyun": "y" "aliyun": "y"
}, },
"client": { "client": {
"App": { "App": {
"app-vue": "y", "app-vue": "y",
"app-nvue": "y" "app-nvue": "y"
}, },
"H5-mobile": { "H5-mobile": {
"Safari": "y", "Safari": "y",
"Android Browser": "y", "Android Browser": "y",
"微信浏览器(Android)": "y", "微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y" "QQ浏览器(Android)": "y"
}, },
"H5-pc": { "H5-pc": {
"Chrome": "y", "Chrome": "y",
"IE": "y", "IE": "y",
"Edge": "y", "Edge": "y",
"Firefox": "y", "Firefox": "y",
"Safari": "y" "Safari": "y"
}, },
"小程序": { "小程序": {
"微信": "y", "微信": "y",
"阿里": "y", "阿里": "y",
"百度": "y", "百度": "y",
"字节跳动": "y", "字节跳动": "y",
"QQ": "y" "QQ": "y"
}, },
"快应用": { "快应用": {
"华为": "u", "华为": "u",
"联盟": "u" "联盟": "u"
} }
} }
} }
} }
} }
\ No newline at end of file
## 0.2.0(2021-07-13) ## 0.2.2(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 优化 在uni-forms组件,与label不对齐的问题
## 0.2.1(2021-07-27)
- 修复 单选默认值为0不能选中的Bug
## 0.2.0(2021-07-13)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 0.1.11(2021-07-06) ## 0.1.11(2021-07-06)
- 优化 删除无用日志 - 优化 删除无用日志
## 0.1.10(2021-07-05) ## 0.1.10(2021-07-05)
......
<template> <template>
<view class="uni-data-checklist"> <view class="uni-data-checklist" :style="{'margin-top':isTop+'px'}">
<template v-if="!isLocal"> <template v-if="!isLocal">
<view class="uni-data-loading"> <view class="uni-data-loading">
<uni-load-more v-if="!mixinDatacomErrorMessage" status="loading" iconType="snow" :iconSize="18" :content-text="contentText"></uni-load-more> <uni-load-more v-if="!mixinDatacomErrorMessage" status="loading" iconType="snow" :iconSize="18" :content-text="contentText"></uni-load-more>
...@@ -74,12 +74,13 @@ ...@@ -74,12 +74,13 @@
// prop: 'modelValue', // prop: 'modelValue',
// event: 'update:modelValue' // event: 'update:modelValue'
// }, // },
emits:['input','update:modelValue','change'],
props: { props: {
mode: { mode: {
type: String, type: String,
default: 'default' default: 'default'
}, },
multiple: { multiple: {
type: Boolean, type: Boolean,
default: false default: false
...@@ -179,12 +180,15 @@ ...@@ -179,12 +180,15 @@
styles: { styles: {
selectedColor: '#007aff', selectedColor: '#007aff',
selectedTextColor: '#333', selectedTextColor: '#333',
} },
isTop:0
}; };
}, },
computed:{ computed:{
dataValue(){ dataValue(){
return this.value || this.modelValue if(this.value === '')return this.modelValue
if(this.modelValue === '') return this.value
return this.value
} }
}, },
created() { created() {
...@@ -192,7 +196,8 @@ ...@@ -192,7 +196,8 @@
this.formItem = this.getForm('uniFormsItem') this.formItem = this.getForm('uniFormsItem')
// this.formItem && this.formItem.setValue(this.value) // this.formItem && this.formItem.setValue(this.value)
if (this.formItem) { if (this.formItem) {
this.isTop = 6
if (this.formItem.name) { if (this.formItem.name) {
this.rename = this.formItem.name this.rename = this.formItem.name
this.form.inputChildrens.push(this) this.form.inputChildrens.push(this)
...@@ -247,7 +252,7 @@ ...@@ -247,7 +252,7 @@
if (this.multiple) { if (this.multiple) {
this.range.forEach(item => { this.range.forEach(item => {
if (values.includes(item[this.map.value] + '')) { if (values.includes(item[this.map.value] + '')) {
detail.value.push(item[this.map.value]) detail.value.push(item[this.map.value])
detail.data.push(item) detail.data.push(item)
...@@ -334,7 +339,7 @@ ...@@ -334,7 +339,7 @@
} }
} }
} }
this.setStyles(item, index) this.setStyles(item, index)
list[index] = item list[index] = item
}) })
return list return list
...@@ -388,7 +393,7 @@ ...@@ -388,7 +393,7 @@
setStyleIcon(item) { setStyleIcon(item) {
let styles = {} let styles = {}
let classles = '' let classles = ''
let selectedColor = this.selectedColor?this.selectedColor:'#007aff' let selectedColor = this.selectedColor?this.selectedColor:'#007aff'
styles['background-color'] = item.selected?selectedColor:'#fff' styles['background-color'] = item.selected?selectedColor:'#fff'
styles['border-color'] = item.selected?selectedColor:'#DCDFE6' styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
...@@ -414,7 +419,7 @@ ...@@ -414,7 +419,7 @@
if(!item.selected && item.disabled){ if(!item.selected && item.disabled){
styles.color = '#999' styles.color = '#999'
} }
for (let i in styles) { for (let i in styles) {
classles += `${i}:${styles[i]};` classles += `${i}:${styles[i]};`
} }
...@@ -503,9 +508,9 @@ ...@@ -503,9 +508,9 @@
border-right-color: #007aff; border-right-color: #007aff;
border-right-style: solid; border-right-style: solid;
border-bottom-width:1px; border-bottom-width:1px;
border-bottom-color: #007aff; border-bottom-color: #007aff;
border-bottom-style: solid; border-bottom-style: solid;
height: 12px; height: 12px;
width: 6px; width: 6px;
left: -5px; left: -5px;
transform-origin: center; transform-origin: center;
...@@ -622,7 +627,7 @@ ...@@ -622,7 +627,7 @@
color: $checked-color; color: $checked-color;
} }
// 选中禁用 // 选中禁用
&.is-disable { &.is-disable {
.checkbox__inner { .checkbox__inner {
opacity: $disable; opacity: $disable;
} }
......
{ {
"id": "uni-data-checkbox", "id": "uni-data-checkbox",
"displayName": "uni-data-checkbox 数据选择器", "displayName": "uni-data-checkbox 数据选择器",
"version": "0.2.0", "version": "0.2.2",
"description": "通过数据驱动的单选框和复选框", "description": "通过数据驱动的单选框和复选框",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
"uniui",
"checkbox", "checkbox",
"", "单选",
"多选",
"单选多选" "单选多选"
], ],
"repository": "https://github.com/dcloudio/uni-ui", "repository": "https://github.com/dcloudio/uni-ui",
......
## 1.1.0(2021-07-13) ## 1.1.1(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 优化 vue3下事件警告的问题
## 1.1.0(2021-07-13)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.0.7(2021-05-12) ## 1.0.7(2021-05-12)
- 新增 组件示例地址 - 新增 组件示例地址
## 1.0.6(2021-02-04) ## 1.0.6(2021-02-04)
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
keypress keypress
// #endif // #endif
}, },
emits:['change'],
props: { props: {
/** /**
* 显示模式(左、右),只在初始化生效 * 显示模式(左、右),只在初始化生效
......
{ {
"id": "uni-drawer", "id": "uni-drawer",
"displayName": "uni-drawer 抽屉", "displayName": "uni-drawer 抽屉",
"version": "1.1.0", "version": "1.1.1",
"description": "抽屉式导航,用于展示侧滑菜单,侧滑导航。", "description": "抽屉式导航,用于展示侧滑菜单,侧滑导航。",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
......
## 0.1.0(2021-07-13) ## 0.1.2(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 优化 vue3下事件警告的问题
## 0.1.1
- 优化 errorMessage 属性支持 Boolean 类型
## 0.1.0(2021-07-13)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 0.0.16(2021-06-29) ## 0.0.16(2021-06-29)
- 修复 confirmType 属性(仅 type="text" 生效)导致多行文本框无法换行的 bug - 修复 confirmType 属性(仅 type="text" 生效)导致多行文本框无法换行的 bug
## 0.0.15(2021-06-21) ## 0.0.15(2021-06-21)
......
...@@ -79,6 +79,7 @@ ...@@ -79,6 +79,7 @@
export default { export default {
name: 'uni-easyinput', name: 'uni-easyinput',
emits:['click','iconClick','update:modelValue','input','focus','blur','confirm'],
model:{ model:{
prop:'modelValue', prop:'modelValue',
event:'update:modelValue' event:'update:modelValue'
...@@ -152,7 +153,7 @@ ...@@ -152,7 +153,7 @@
} }
}, },
errorMessage:{ errorMessage:{
type:String, type:[String,Boolean],
default:'' default:''
} }
}, },
......
{ {
"id": "uni-easyinput", "id": "uni-easyinput",
"displayName": "uni-easyinput 增强输入框", "displayName": "uni-easyinput 增强输入框",
"version": "0.1.0", "version": "0.1.2",
"description": "Easyinput 组件是对原生input组件的增强", "description": "Easyinput 组件是对原生input组件的增强",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
......
## 1.0.7(2021-05-12) ## 1.1.0(2021-07-30)
- 新增 组件示例地址 - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.0.7(2021-05-12)
- 新增 组件示例地址
## 1.0.6(2021-02-05) ## 1.0.6(2021-02-05)
- 调整为uni_modules目录规范 - 调整为uni_modules目录规范
- 优化 按钮背景色调整 - 优化 按钮背景色调整
......
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
*/ */
export default { export default {
name: 'UniFab', name: 'UniFab',
emits:['fabClick','trigger'],
props: { props: {
pattern: { pattern: {
type: Object, type: Object,
......
{ {
"id": "uni-fab", "id": "uni-fab",
"displayName": "uni-fab 悬浮按钮", "displayName": "uni-fab 悬浮按钮",
"version": "1.0.7", "version": "1.1.0",
"description": "悬浮按钮 fab button ,点击可展开一个图标按钮菜单。", "description": "悬浮按钮 fab button ,点击可展开一个图标按钮菜单。",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
......
## 0.2.1(2021-07-26) ## 0.2.9(2021-08-03)
- 修复 vue3下双向绑定失效的Bug - 修复 auto-upload 属性失效的Bug
## 0.2.8(2021-07-31)
- 修复 fileExtname属性不指定值报错的Bug
## 0.2.7(2021-07-31)
- 修复 在某种场景下图片不回显的Bug
## 0.2.6(2021-07-30)
- 修复 return-type为object下,返回值不正确的Bug
## 0.2.5(2021-07-30)
- 修复(重要) H5 平台下如果和uni-forms组件一同使用导致页面卡死的问题
## 0.2.3(2021-07-28)
- 优化 调整示例代码
## 0.2.2(2021-07-27)
- 修复 vue3 下赋值错误的Bug
- 优化 h5平台下上传文件导致页面卡死的问题
## 0.2.0(2021-07-13) ## 0.2.0(2021-07-13)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 0.1.1(2021-07-02) ## 0.1.1(2021-07-02)
......
'use strict'; 'use strict';
// Object.defineProperty(exports, '__esModule', { value: true });
const ERR_MSG_OK = 'chooseAndUploadFile:ok'; const ERR_MSG_OK = 'chooseAndUploadFile:ok';
const ERR_MSG_FAIL = 'chooseAndUploadFile:fail'; const ERR_MSG_FAIL = 'chooseAndUploadFile:fail';
function chooseImage(opts) { function chooseImage(opts) {
const { count, sizeType = ['original','compressed'], sourceType = ['album', 'camera'], extension } = opts const {
return new Promise((resolve, reject) => { count,
uni.chooseImage({ sizeType = ['original', 'compressed'],
count, sourceType = ['album', 'camera'],
sizeType, extension
sourceType, } = opts
extension, return new Promise((resolve, reject) => {
success(res) { uni.chooseImage({
resolve(normalizeChooseAndUploadFileRes(res, 'image')); count,
}, sizeType,
fail(res) { sourceType,
reject({ extension,
errMsg: res.errMsg.replace('chooseImage:fail', ERR_MSG_FAIL), success(res) {
}); resolve(normalizeChooseAndUploadFileRes(res, 'image'));
}, },
}); fail(res) {
}); reject({
errMsg: res.errMsg.replace('chooseImage:fail', ERR_MSG_FAIL),
});
},
});
});
} }
function chooseVideo(opts) { function chooseVideo(opts) {
const { camera, compressed, maxDuration, sourceType = ['album', 'camera'], extension } = opts; const {
return new Promise((resolve, reject) => { camera,
uni.chooseVideo({ compressed,
camera, maxDuration,
compressed, sourceType = ['album', 'camera'],
maxDuration, extension
sourceType, } = opts;
extension, return new Promise((resolve, reject) => {
success(res) { uni.chooseVideo({
const { tempFilePath, duration, size, height, width } = res; camera,
resolve(normalizeChooseAndUploadFileRes({ compressed,
errMsg: 'chooseVideo:ok', maxDuration,
tempFilePaths: [tempFilePath], sourceType,
tempFiles: [ extension,
{ success(res) {
name: (res.tempFile && res.tempFile.name) || '', const {
path: tempFilePath, tempFilePath,
size, duration,
type: (res.tempFile && res.tempFile.type) || '', size,
width, height,
height, width
duration, } = res;
fileType: 'video', resolve(normalizeChooseAndUploadFileRes({
cloudPath: '', errMsg: 'chooseVideo:ok',
}, tempFilePaths: [tempFilePath],
], tempFiles: [
}, 'video')); {
}, name: (res.tempFile && res.tempFile.name) || '',
fail(res) { path: tempFilePath,
reject({ size,
errMsg: res.errMsg.replace('chooseVideo:fail', ERR_MSG_FAIL), type: (res.tempFile && res.tempFile.type) || '',
}); width,
}, height,
}); duration,
}); fileType: 'video',
cloudPath: '',
}, ],
}, 'video'));
},
fail(res) {
reject({
errMsg: res.errMsg.replace('chooseVideo:fail', ERR_MSG_FAIL),
});
},
});
});
} }
function chooseAll(opts) { function chooseAll(opts) {
const { count, extension } = opts; const {
return new Promise((resolve, reject) => { count,
let chooseFile = uni.chooseFile; extension
if (typeof wx !== 'undefined' && } = opts;
typeof wx.chooseMessageFile === 'function') { return new Promise((resolve, reject) => {
chooseFile = wx.chooseMessageFile; let chooseFile = uni.chooseFile;
} if (typeof wx !== 'undefined' &&
if (typeof chooseFile !== 'function') { typeof wx.chooseMessageFile === 'function') {
return reject({ chooseFile = wx.chooseMessageFile;
errMsg: ERR_MSG_FAIL + ' 请指定 type 类型,该平台仅支持选择 image 或 video。', }
}); if (typeof chooseFile !== 'function') {
} return reject({
chooseFile({ errMsg: ERR_MSG_FAIL + ' 请指定 type 类型,该平台仅支持选择 image 或 video。',
type: 'all', });
count, }
extension, chooseFile({
success(res) { type: 'all',
resolve(normalizeChooseAndUploadFileRes(res)); count,
}, extension,
fail(res) { success(res) {
reject({ resolve(normalizeChooseAndUploadFileRes(res));
errMsg: res.errMsg.replace('chooseFile:fail', ERR_MSG_FAIL), },
}); fail(res) {
}, reject({
}); errMsg: res.errMsg.replace('chooseFile:fail', ERR_MSG_FAIL),
}); });
},
});
});
} }
function normalizeChooseAndUploadFileRes(res, fileType) { function normalizeChooseAndUploadFileRes(res, fileType) {
res.tempFiles.forEach((item, index) => { res.tempFiles.forEach((item, index) => {
if (!item.name) { if (!item.name) {
item.name = item.path.substring(item.path.lastIndexOf('/') + 1); item.name = item.path.substring(item.path.lastIndexOf('/') + 1);
} }
if (fileType) { if (fileType) {
item.fileType = fileType; item.fileType = fileType;
} }
item.cloudPath = item.cloudPath =
Date.now() + '_' + index + item.name.substring(item.name.lastIndexOf('.')); Date.now() + '_' + index + item.name.substring(item.name.lastIndexOf('.'));
}); });
// wx.chooseMessageFile if (!res.tempFilePaths) {
if (!res.tempFilePaths) { res.tempFilePaths = res.tempFiles.map((file) => file.path);
res.tempFilePaths = res.tempFiles.map((file) => file.path); }
} return res;
return res;
} }
function uploadCloudFiles(res, max = 5, onUploadProgress) {}
function uploadFiles(choosePromise, { onChooseFile, onUploadProgress }) { function uploadCloudFiles(files, max = 5, onUploadProgress) {
return choosePromise files = JSON.parse(JSON.stringify(files))
.then((res) => { const len = files.length
if (onChooseFile) { let count = 0
const customChooseRes = onChooseFile(res); let self = this
if (typeof customChooseRes !== 'undefined') { return new Promise(resolve => {
return Promise.resolve(customChooseRes).then((chooseRes) => typeof chooseRes === 'undefined' ? res : chooseRes); while (count < max) {
} next()
} }
return res;
}) function next() {
.then((res) => { let cur = count++
if (res === false) { if (cur >= len) {
return { !files.find(item => !item.url && !item.errMsg) && resolve(files)
errMsg: ERR_MSG_OK, return
tempFilePaths: [], }
tempFiles: [], const fileItem = files[cur]
}; const index = self.files.findIndex(v => v.uuid === fileItem.uuid)
} fileItem.url = ''
return res delete fileItem.errMsg
// return uploadCloudFiles(res, 5, onUploadProgress);
}) uniCloud
.uploadFile({
filePath: fileItem.path,
cloudPath: fileItem.cloudPath,
fileType: fileItem.fileType,
onUploadProgress: res => {
res.index = index
onUploadProgress && onUploadProgress(res)
}
})
.then(res => {
fileItem.url = res.fileID
fileItem.index = index
if (cur < len) {
next()
}
})
.catch(res => {
fileItem.errMsg = res.errMsg || res.message
fileItem.index = index
if (cur < len) {
next()
}
})
}
})
} }
function chooseAndUploadFile(opts = { type: 'all' }) {
if (opts.type === 'image') {
return uploadFiles(chooseImage(opts), opts);
}
else if (opts.type === 'video') {
return uploadFiles(chooseVideo(opts), opts); function uploadFiles(choosePromise, {
} onChooseFile,
return uploadFiles(chooseAll(opts), opts); onUploadProgress
} }) {
return choosePromise
export {chooseAndUploadFile}; .then((res) => {
if (onChooseFile) {
const customChooseRes = onChooseFile(res);
if (typeof customChooseRes !== 'undefined') {
return Promise.resolve(customChooseRes).then((chooseRes) => typeof chooseRes === 'undefined' ?
res : chooseRes);
}
}
return res;
})
.then((res) => {
if (res === false) {
return {
errMsg: ERR_MSG_OK,
tempFilePaths: [],
tempFiles: [],
};
}
return res
})
}
function chooseAndUploadFile(opts = {
type: 'all'
}) {
if (opts.type === 'image') {
return uploadFiles(chooseImage(opts), opts);
}
else if (opts.type === 'video') {
return uploadFiles(chooseVideo(opts), opts);
}
return uploadFiles(chooseAll(opts), opts);
}
export {
chooseAndUploadFile,
uploadCloudFiles
};
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
<script> <script>
export default { export default {
name: "uploadFile", name: "uploadFile",
emits:['uploadFiles','choose','delFile'],
props: { props: {
filesList: { filesList: {
type: Array, type: Array,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view class="uni-file-picker__container"> <view class="uni-file-picker__container">
<view class="file-picker__box" v-for="(item,index) in filesList" :key="index" :style="boxStyle"> <view class="file-picker__box" v-for="(item,index) in filesList" :key="index" :style="boxStyle">
<view class="file-picker__box-content" :style="borderStyle"> <view class="file-picker__box-content" :style="borderStyle">
<image class="file-image" :src="item.path" mode="aspectFill" @click.stop="prviewImage(item,index)"></image> <image class="file-image" :src="item.url" mode="aspectFill" @click.stop="prviewImage(item,index)"></image>
<view v-if="delIcon && !readonly" class="icon-del-box" @click.stop="delFile(index)"> <view v-if="delIcon && !readonly" class="icon-del-box" @click.stop="delFile(index)">
<view class="icon-del"></view> <view class="icon-del"></view>
<view class="icon-del rotate"></view> <view class="icon-del rotate"></view>
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
<script> <script>
export default { export default {
name: "uploadImage", name: "uploadImage",
emits:['uploadFiles','choose','delFile'],
props: { props: {
filesList: { filesList: {
type: Array, type: Array,
......
/**
* 获取文件名和后缀
* @param {String} name
*/
export const get_file_ext = (name) => {
const last_len = name.lastIndexOf('.')
const len = name.length
return {
name: name.substring(0, last_len),
ext: name.substring(last_len + 1, len)
}
}
/**
* 获取扩展名
* @param {Array} fileExtname
*/
export const get_extname = (fileExtname) => {
if (!Array.isArray(fileExtname)) {
let extname = fileExtname.replace(/(\[|\])/g, '')
return extname.split(',')
} else {
return fileExtname
}
return []
}
/**
* 获取文件和检测是否可选
*/
export const get_files_and_is_max = (res, _extname) => {
let filePaths = []
let files = []
if(!_extname || _extname.length === 0){
return {
filePaths,
files
}
}
res.tempFiles.forEach(v => {
let fileFullName = get_file_ext(v.name)
const extname = fileFullName.ext.toLowerCase()
if (_extname.indexOf(extname) !== -1) {
files.push(v)
filePaths.push(v.path)
}
})
if (files.length !== res.tempFiles.length) {
uni.showToast({
title: `当前选择了${res.tempFiles.length}个文件 ,${res.tempFiles.length - files.length} 个文件格式不正确`,
icon: 'none',
duration: 5000
})
}
return {
filePaths,
files
}
}
/**
* 获取图片信息
* @param {Object} filepath
*/
export const get_file_info = (filepath) => {
return new Promise((resolve, reject) => {
uni.getImageInfo({
src: filepath,
success(res) {
resolve(res)
},
fail(err) {
reject(err)
}
})
})
}
/**
* 获取封装数据
*/
export const get_file_data = async (files, type = 'image') => {
// 最终需要上传数据库的数据
let fileFullName = get_file_ext(files.name)
const extname = fileFullName.ext.toLowerCase()
let filedata = {
name: files.name,
uuid: files.uuid,
extname: extname || '',
cloudPath: files.cloudPath,
fileType: files.fileType,
url: files.path || files.path,
size: files.size, //单位是字节
image: {},
path: files.path,
video: {}
}
if (type === 'image') {
const imageinfo = await get_file_info(files.path)
delete filedata.video
filedata.image.width = imageinfo.width
filedata.image.height = imageinfo.height
filedata.image.location = imageinfo.path
} else {
delete filedata.image
}
return filedata
}
{ {
"id": "uni-file-picker", "id": "uni-file-picker",
"displayName": "uni-file-picker 文件选择上传", "displayName": "uni-file-picker 文件选择上传",
"version": "0.2.1", "version": "0.2.9",
"description": "文件选择上传组件,可以选择图片、视频等任意文件并上传到当前绑定的服务空间", "description": "文件选择上传组件,可以选择图片、视频等任意文件并上传到当前绑定的服务空间",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
"图片上传", "uniui",
"上传" "图片上传",
"文件上传"
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": ""
},
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"category": [
"前端组件",
"通用组件"
], ],
"repository": "https://github.com/dcloudio/uni-ui", "sale": {
"engines": { "regular": {
"HBuilderX": "" "price": "0.00"
}, },
"directories": { "sourcecode": {
"example": "../../temps/example_temps" "price": "0.00"
}, }
"dcloudext": { },
"category": [ "contact": {
"前端组件", "qq": ""
"通用组件" },
], "declaration": {
"sale": { "ads": "无",
"regular": { "data": "无",
"price": "0.00" "permissions": "无"
}, },
"sourcecode": { "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
"price": "0.00" },
} "uni_modules": {
}, "dependencies": [],
"contact": { "encrypt": [],
"qq": "" "platforms": {
}, "cloud": {
"declaration": { "tcb": "y",
"ads": "无", "aliyun": "y"
"data": "无", },
"permissions": "无" "client": {
}, "App": {
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "app-vue": "y",
}, "app-nvue": "n"
"uni_modules": { },
"dependencies": [], "H5-mobile": {
"encrypt": [], "Safari": "y",
"platforms": { "Android Browser": "y",
"cloud": { "微信浏览器(Android)": "y",
"tcb": "y", "QQ浏览器(Android)": "y"
"aliyun": "y" },
}, "H5-pc": {
"client": { "Chrome": "y",
"App": { "IE": "y",
"app-vue": "y", "Edge": "y",
"app-nvue": "n" "Firefox": "y",
}, "Safari": "y"
"H5-mobile": { },
"Safari": "y", "小程序": {
"Android Browser": "y", "微信": "y",
"微信浏览器(Android)": "y", "阿里": "y",
"QQ浏览器(Android)": "y" "百度": "y",
}, "字节跳动": "y",
"H5-pc": { "QQ": "y"
"Chrome": "y", },
"IE": "y", "快应用": {
"Edge": "y", "华为": "u",
"Firefox": "y", "联盟": "u"
"Safari": "y" },
}, "Vue": {
"小程序": { "vue2": "y",
"微信": "y", "vue3": "u"
"阿里": "y", }
"百度": "y", }
"字节跳动": "y", }
"QQ": "y" }
}, }
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}
## 1.2.1(2021-07-22) ## 1.2.3(2021-07-30)
- 修复 动态校验表单,默认值为空的情况下校验失效的Bug - 优化 vue3下事件警告的问题
- 修复 不指定name属性时,运行报错的Bug ## 1.2.2(2021-07-26)
- 优化 label默认宽度从65调整至70,使required为true且四字时不换行 - 修复 vue2 下条件编译导致destroyed生命周期失效的Bug
- 优化 组件示例,新增动态校验示例代码 - 修复 1.2.1 引起的示例在小程序平台报错的Bug
- 优化 组件文档,使用方式更清晰 ## 1.2.1(2021-07-22)
- 修复 动态校验表单,默认值为空的情况下校验失效的Bug
- 修复 不指定name属性时,运行报错的Bug
- 优化 label默认宽度从65调整至70,使required为true且四字时不换行
- 优化 组件示例,新增动态校验示例代码
- 优化 组件文档,使用方式更清晰
## 1.2.0(2021-07-13) ## 1.2.0(2021-07-13)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.1.2(2021-06-25) ## 1.1.2(2021-06-25)
......
...@@ -179,30 +179,18 @@ export default { ...@@ -179,30 +179,18 @@ export default {
} }
this.init(); this.init();
}, },
// TODO vue2 // #ifndef VUE3
destroyed() { destroyed() {
if(this.__isUnmounted) return if(this.__isUnmounted) return
if (this.form) { this.unInit()
this.form.childrens.forEach((item, index) => { },
if (item === this) { // #endif
this.form.childrens.splice(index, 1) // #ifdef VUE3
delete this.form.formData[item.name] unmounted(){
} this.__isUnmounted = true
}) this.unInit()
} },
}, // #endif
// TODO vue3
unmounted(){
this.__isUnmounted = true
if (this.form) {
this.form.childrens.forEach((item, index) => {
if (item === this) {
this.form.childrens.splice(index, 1)
delete this.form.formData[item.name]
}
})
}
},
methods: { methods: {
init() { init() {
if (this.form) { if (this.form) {
...@@ -247,13 +235,23 @@ export default { ...@@ -247,13 +235,23 @@ export default {
if (this.rules.length > 0) { if (this.rules.length > 0) {
validator.updateSchema(formRules); validator.updateSchema(formRules);
} }
this.validator = validator; this.validator = validator;
} else { } else {
this.labelPos = this.labelPosition || 'left'; this.labelPos = this.labelPosition || 'left';
this.labelWid = this.labelWidth || 65; this.labelWid = this.labelWidth || 65;
this.labelAli = this.labelAlign || 'left'; this.labelAli = this.labelAlign || 'left';
} }
},
unInit(){
if (this.form) {
this.form.childrens.forEach((item, index) => {
if (item === this) {
this.form.childrens.splice(index, 1)
delete this.form.formData[item.name]
}
})
}
}, },
/** /**
* 获取父元素实例 * 获取父元素实例
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
prop: 'modelValue', prop: 'modelValue',
event: 'update:modelValue' event: 'update:modelValue'
}, },
emits:['update:modelValue','input','reset','validate','submit'],
props: { props: {
// 即将弃用 // 即将弃用
value: { value: {
...@@ -252,6 +253,7 @@ ...@@ -252,6 +253,7 @@
if (inputComp) { if (inputComp) {
inputComp.errMsg = ''; inputComp.errMsg = '';
inputComp.$emit('input', inputComp.multiple ? [] : ''); inputComp.$emit('input', inputComp.multiple ? [] : '');
inputComp.$emit('update:modelValue', inputComp.multiple ? [] : '');
} }
}); });
......
{ {
"id": "uni-forms", "id": "uni-forms",
"displayName": "uni-forms 表单", "displayName": "uni-forms 表单",
"version": "1.2.1", "version": "1.2.3",
"description": "由输入框、选择器、单选框、多选框等控件组成,用以收集、校验、提交数据", "description": "由输入框、选择器、单选框、多选框等控件组成,用以收集、校验、提交数据",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
...@@ -82,4 +82,4 @@ ...@@ -82,4 +82,4 @@
} }
} }
} }
} }
...@@ -80,7 +80,6 @@ uni-app的内置组件已经有了 `<form>`组件,用于提交表单内容。 ...@@ -80,7 +80,6 @@ uni-app的内置组件已经有了 `<form>`组件,用于提交表单内容。
### 如何使用 ### 如何使用
1. `uni-forms` 需要通过 `rules` 属性传入约定的校验规则,详细描述下文`校验规则说明` 1. `uni-forms` 需要通过 `rules` 属性传入约定的校验规则,详细描述下文`校验规则说明`
```html ```html
<!-- rules 内容详见下方完整示例 --> <!-- rules 内容详见下方完整示例 -->
<uni-forms ref="form" :rules="rules"> <uni-forms ref="form" :rules="rules">
...@@ -89,7 +88,6 @@ uni-app的内置组件已经有了 `<form>`组件,用于提交表单内容。 ...@@ -89,7 +88,6 @@ uni-app的内置组件已经有了 `<form>`组件,用于提交表单内容。
``` ```
2. `uni-forms` 需要绑定`modelValue`属性,值为表单的key\value 组成的对象。 2. `uni-forms` 需要绑定`modelValue`属性,值为表单的key\value 组成的对象。
```html ```html
<!-- formData、rules 内容详见下方完整示例 --> <!-- formData、rules 内容详见下方完整示例 -->
<uni-forms ref="form" :modelValue="formData" :rules="rules"> <uni-forms ref="form" :modelValue="formData" :rules="rules">
...@@ -98,7 +96,6 @@ uni-app的内置组件已经有了 `<form>`组件,用于提交表单内容。 ...@@ -98,7 +96,6 @@ uni-app的内置组件已经有了 `<form>`组件,用于提交表单内容。
``` ```
3. `uni-forms-item` 需要设置 `name` 属性为当前字段名,字段为 `String` 类型而非变量。 3. `uni-forms-item` 需要设置 `name` 属性为当前字段名,字段为 `String` 类型而非变量。
```html ```html
<!-- formData、rules 内容详见下方完整示例 --> <!-- formData、rules 内容详见下方完整示例 -->
<uni-forms :modelValue="formData" :rules="rules"> <uni-forms :modelValue="formData" :rules="rules">
...@@ -433,29 +430,25 @@ export default { ...@@ -433,29 +430,25 @@ export default {
多用于同一个字段需要添加多次的场景,如需要动态创建多个域名参与检验。 多用于同一个字段需要添加多次的场景,如需要动态创建多个域名参与检验。
1.`formData` 中定义个变量用来接受同一个字段的多个结果 1.`formData` 中定义个变量用来接受同一个字段的多个结果
```javascript ```javascript
dynamicFormData: { dynamicFormData: {
email: '', email: '',
// domains 字段下会有多个结果 // domains 字段下会有多个结果
domains: {} domains: {}
} }
``` ```
2. 使用 `uni-forms-item``rules` 属性定义单个表单域的校验规则。 2. 使用 `uni-forms-item``rules` 属性定义单个表单域的校验规则。
```html ```html
<uni-forms-item :label="item.label+' '+index" required <uni-forms-item :label="item.label+' '+index" required
:rules="[{'required': true,errorMessage: '域名项必填'}]" :key="item.id"> :rules="[{'required': true,errorMessage: '域名项必填'}]" :key="item.id">
... ...
</uni-forms-item> </uni-forms-item>
``` ```
3. `name` 需要动态指定,格式为: `字段[唯一值]` 3. `name` 需要动态指定,格式为: `字段[唯一值]`
```html ```html
<uni-forms-item <uni-forms-item
required required
...@@ -466,12 +459,9 @@ dynamicFormData: { ...@@ -466,12 +459,9 @@ dynamicFormData: {
> >
... ...
</uni-forms-item> </uni-forms-item>
``` ```
4. 需要绑定值的组件的 v-model 也需要动态指定,格式为:`数据源.字段[唯一值]` 4. 需要绑定值的组件的 v-model 也需要动态指定,格式为:`数据源.字段[唯一值]`
```html ```html
<uni-forms-item <uni-forms-item
required required
...@@ -482,7 +472,6 @@ dynamicFormData: { ...@@ -482,7 +472,6 @@ dynamicFormData: {
> >
<uni-easyinput v-model="dynamicFormData.domains[item.id]" placeholder="请输入域名" /> <uni-easyinput v-model="dynamicFormData.domains[item.id]" placeholder="请输入域名" />
</uni-forms-item> </uni-forms-item>
``` ```
**完整示例** **完整示例**
......
## 1.3.0(2021-07-13) ## 1.3.1(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 优化 vue3下事件警告的问题
## 1.3.0(2021-07-13)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.2.4(2021-05-12) ## 1.2.4(2021-05-12)
- 新增 组件示例地址 - 新增 组件示例地址
## 1.2.3(2021-02-05) ## 1.2.3(2021-02-05)
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
*/ */
export default { export default {
name: 'UniGrid', name: 'UniGrid',
emits:['change'],
props: { props: {
// 每列显示个数 // 每列显示个数
column: { column: {
......
{ {
"id": "uni-grid", "id": "uni-grid",
"displayName": "uni-grid 宫格", "displayName": "uni-grid 宫格",
"version": "1.3.0", "version": "1.3.1",
"description": "Grid 宫格组件,提供移动端常见的宫格布局,如九宫格。", "description": "Grid 宫格组件,提供移动端常见的宫格布局,如九宫格。",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
......
## 1.0.3(2021-05-12) ## 1.1.0(2021-07-30)
- 新增 组件示例地址 - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
- 优化 组件文档
## 1.0.3(2021-05-12)
- 新增 组件示例地址
## 1.0.2(2021-02-05) ## 1.0.2(2021-02-05)
- 调整为uni_modules目录规范 - 调整为uni_modules目录规范
- 优化 兼容 nvue 页面 - 优化 兼容 nvue 页面
...@@ -18,9 +18,11 @@ ...@@ -18,9 +18,11 @@
* @tutorial https://ext.dcloud.net.cn/plugin?id=3281 * @tutorial https://ext.dcloud.net.cn/plugin?id=3281
* @property {String} title 主标题 * @property {String} title 主标题
* @property {Number} top 分组间隔 * @property {Number} top 分组间隔
* @property {Number} mode 模式
*/ */
export default { export default {
name: 'uniGroup', name: 'uniGroup',
emits:['click'],
props: { props: {
title: { title: {
type: String, type: String,
......
{ {
"id": "uni-group", "id": "uni-group",
"displayName": "uni-group 分组", "displayName": "uni-group 分组",
"version": "1.0.3", "version": "1.1.0",
"description": "分组组件可用于将组件用于分组,添加间隔,以产生明显的区块", "description": "分组组件可用于将组件用于分组,添加间隔,以产生明显的区块",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
``template`` 中使用组件 ``template`` 中使用组件
```html ```html
<uni-group title="分组1" margin-top="20"> <uni-group title="分组1" top="20">
<view>分组1 的内容</view> <view>分组1 的内容</view>
<view>分组1 的内容</view> <view>分组1 的内容</view>
</uni-group> </uni-group>
...@@ -41,10 +41,11 @@ ...@@ -41,10 +41,11 @@
### 属性说明 ### 属性说明
属性名|类型|默认值|说明 |属性名|类型|默认值|说明|
:-:|:-:|:-:|:-: |:-:|:-:|:-:|:-:|
title|String|主标题| |title|String|-|主标题|
top|Number|分组间隔| |top|Number|-|分组间隔|
|mode|String|''|模式 ,card 为卡片模式|
......
## 1.1.5(2021-05-12) ## 1.2.0(2021-07-30)
- 新增 组件示例地址 - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.1.5(2021-05-12)
- 新增 组件示例地址
## 1.1.4(2021-02-05) ## 1.1.4(2021-02-05)
- 调整为uni_modules目录规范 - 调整为uni_modules目录规范
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
*/ */
export default { export default {
name: 'UniIcons', name: 'UniIcons',
emits:['click'],
props: { props: {
type: { type: {
type: String, type: String,
......
{ {
"id": "uni-icons", "id": "uni-icons",
"displayName": "uni-icons 图标", "displayName": "uni-icons 图标",
"version": "1.1.5", "version": "1.2.0",
"description": "图标组件,用于展示移动端常见的图标,可自定义颜色、大小。", "description": "图标组件,用于展示移动端常见的图标,可自定义颜色、大小。",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
......
var nvMask,nvImageMenu; var nvMask,nvImageMenu;
export default { export default {
show({list,cancelText},callback){ show({list,cancelText},callback){
console.log(789789879);
if(!list){ if(!list){
list = [{ list = [{
"img":"/static/sharemenu/wechatfriend.png", "img":"/static/sharemenu/wechatfriend.png",
...@@ -30,6 +31,9 @@ export default { ...@@ -30,6 +31,9 @@ export default {
var left4 = left1 + (iconWidth + iconSpace) * 3 var left4 = left1 + (iconWidth + iconSpace) * 3
var top1 = left1 var top1 = left1
var top2 = top1 + iconWidth + icontextSpace + textHeight + left1 var top2 = top1 + iconWidth + icontextSpace + textHeight + left1
const TOP = {top1,top2}, LEFT = {left1,left2,left3,left4};
nvMask = new plus.nativeObj.View("nvMask", { //先创建遮罩层 nvMask = new plus.nativeObj.View("nvMask", { //先创建遮罩层
top: '0px', top: '0px',
left: '0px', left: '0px',
...@@ -55,8 +59,8 @@ export default { ...@@ -55,8 +59,8 @@ export default {
tag: 'img', tag: 'img',
src: item.img, src: item.img,
position: { position: {
top: eval('top'+( parseInt(i/4) +1)), top: TOP['top'+( parseInt(i/4) +1)],
left: eval('left'+(1+i%4)), left: LEFT['left'+(1+i%4)],
width: iconWidth, width: iconWidth,
height: iconWidth height: iconWidth
} }
...@@ -68,8 +72,8 @@ export default { ...@@ -68,8 +72,8 @@ export default {
size: textHeight size: textHeight
}, },
position: { position: {
top: eval('top'+(parseInt(i/4)+1)) + iconWidth + icontextSpace, top: TOP['top'+(parseInt(i/4)+1)] + iconWidth + icontextSpace,
left: eval('left'+(1+i%4)), left: LEFT['left'+(1+i%4)],
width: iconWidth, width: iconWidth,
height: textHeight height: textHeight
} }
......
## 1.0.11(2021-05-12) ## 1.1.0(2021-07-30)
- 新增 组件示例地址 - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.0.11(2021-05-12)
- 新增 组件示例地址
## 1.0.10(2021-04-21) ## 1.0.10(2021-04-21)
- 优化 添加依赖 uni-icons, 导入后自动下载依赖 - 优化 添加依赖 uni-icons, 导入后自动下载依赖
## 1.0.9(2021-02-05) ## 1.0.9(2021-02-05)
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<script> <script>
export default { export default {
name: 'UniIndexedList', name: 'UniIndexedList',
emits:['itemClick'],
props: { props: {
loaded: { loaded: {
type: Boolean, type: Boolean,
......
...@@ -87,6 +87,7 @@ ...@@ -87,6 +87,7 @@
components: { components: {
indexedListItem indexedListItem
}, },
emits:['click'],
props: { props: {
options: { options: {
type: Array, type: Array,
......
{ {
"id": "uni-indexed-list", "id": "uni-indexed-list",
"displayName": "uni-indexed-list 索引列表", "displayName": "uni-indexed-list 索引列表",
"version": "1.0.11", "version": "1.1.0",
"description": "索引列表", "description": "索引列表组件,右侧带索引的列表,方便快速定位到具体内容,通常用于城市/机场选择等场景",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
"uniui", "索引列表",
"索引列表" "索引",
"列表"
], ],
"repository": "https://github.com/dcloudio/uni-ui", "repository": "https://github.com/dcloudio/uni-ui",
"engines": { "engines": {
...@@ -80,4 +81,4 @@ ...@@ -80,4 +81,4 @@
} }
} }
} }
} }
\ No newline at end of file
## 0.0.6(2021-07-30)
- 支持自定义插槽
## 0.0.5(2021-06-21) ## 0.0.5(2021-06-21)
- 新增 download 属性,H5平台下载文件名 - 新增 download 属性,H5平台下载文件名
## 0.0.4(2021-05-12) ## 0.0.4(2021-05-12)
- 新增 组件示例地址 - 新增 组件示例地址
## 0.0.3(2021-03-09) ## 0.0.3(2021-03-09)
- 新增 href 属性支持 tel:|mailto: - 新增 href 属性支持 tel:|mailto:
## 0.0.2(2021-02-05) ## 0.0.2(2021-02-05)
- 调整为uni_modules目录规范 - 调整为uni_modules目录规范
<template> <template>
<a v-if="isShowA" class="uni-link" :href="href" <a v-if="isShowA" class="uni-link" :href="href"
:class="{'uni-link--withline':showUnderLine===true||showUnderLine==='true'}" :class="{'uni-link--withline':showUnderLine===true||showUnderLine==='true'}"
:style="{color,fontSize:fontSize+'px'}" :download="download">{{text}}</a> :style="{color,fontSize:fontSize+'px'}" :download="download">
<text v-else class="uni-link" :class="{'uni-link--withline':showUnderLine===true||showUnderLine==='true'}" <slot>{{text}}</slot>
:style="{color,fontSize:fontSize+'px'}" @click="openURL">{{text}}</text> </a>
</template> <text v-else class="uni-link" :class="{'uni-link--withline':showUnderLine===true||showUnderLine==='true'}"
:style="{color,fontSize:fontSize+'px'}" @click="openURL">
<script> <slot>{{text}}</slot>
/** </text>
* Link 外部网页超链接组件 </template>
* @description uni-link是一个外部网页超链接组件,在小程序内复制url,在app内打开外部浏览器,在h5端打开新网页
* @tutorial https://ext.dcloud.net.cn/plugin?id=1182 <script>
* @property {String} href 点击后打开的外部网页url /**
* @property {String} text 显示的文字 * Link 外部网页超链接组件
* @property {String} downlaod H5平台下载文件名 * @description uni-link是一个外部网页超链接组件,在小程序内复制url,在app内打开外部浏览器,在h5端打开新网页
* @property {Boolean} showUnderLine 是否显示下划线 * @tutorial https://ext.dcloud.net.cn/plugin?id=1182
* @property {String} copyTips 在小程序端复制链接时显示的提示语 * @property {String} href 点击后打开的外部网页url
* @property {String} color 链接文字颜色 * @property {String} text 显示的文字
* @property {String} fontSize 链接文字大小 * @property {String} downlaod H5平台下载文件名
* @example * <uni-link href="https://ext.dcloud.net.cn" text="https://ext.dcloud.net.cn"></uni-link> * @property {Boolean} showUnderLine 是否显示下划线
*/ * @property {String} copyTips 在小程序端复制链接时显示的提示语
export default { * @property {String} color 链接文字颜色
name: 'uniLink', * @property {String} fontSize 链接文字大小
props: { * @example * <uni-link href="https://ext.dcloud.net.cn" text="https://ext.dcloud.net.cn"></uni-link>
href: { */
type: String, export default {
default: '' name: 'uniLink',
}, props: {
text: { href: {
type: String, type: String,
default: '' default: ''
}, },
download: { text: {
type: String, type: String,
default: '' default: ''
}, },
showUnderLine: { download: {
type: [Boolean, String], type: String,
default: true default: ''
}, },
copyTips: { showUnderLine: {
type: String, type: [Boolean, String],
default: '已自动复制网址,请在手机浏览器里粘贴该网址' default: true
}, },
color: { copyTips: {
type: String, type: String,
default: '#999999' default: '已自动复制网址,请在手机浏览器里粘贴该网址'
}, },
fontSize: { color: {
type: [Number, String], type: String,
default: 14 default: '#999999'
} },
}, fontSize: {
computed: { type: [Number, String],
isShowA() { default: 14
// #ifdef H5 }
this._isH5 = true; },
// #endif computed: {
if ((this.isMail() || this.isTel()) && this._isH5 === true) { isShowA() {
return true; // #ifdef H5
} this._isH5 = true;
return false; // #endif
} if ((this.isMail() || this.isTel()) && this._isH5 === true) {
}, return true;
created() { }
this._isH5 = null; return false;
}, }
methods: { },
isMail() { created() {
return this.href.startsWith('mailto:'); this._isH5 = null;
}, },
isTel() { methods: {
return this.href.startsWith('tel:'); isMail() {
}, return this.href.startsWith('mailto:');
openURL() { },
// #ifdef APP-PLUS isTel() {
if (this.isTel()) { return this.href.startsWith('tel:');
this.makePhoneCall(this.href.replace('tel:', '')); },
} else { openURL() {
plus.runtime.openURL(this.href); // #ifdef APP-PLUS
} if (this.isTel()) {
// #endif this.makePhoneCall(this.href.replace('tel:', ''));
// #ifdef H5 } else {
window.open(this.href) plus.runtime.openURL(this.href);
// #endif }
// #ifdef MP // #endif
uni.setClipboardData({ // #ifdef H5
data: this.href window.open(this.href)
}); // #endif
uni.showModal({ // #ifdef MP
content: this.copyTips, uni.setClipboardData({
showCancel: false data: this.href
}); });
// #endif uni.showModal({
}, content: this.copyTips,
makePhoneCall(phoneNumber) { showCancel: false
uni.makePhoneCall({ });
phoneNumber // #endif
}) },
} makePhoneCall(phoneNumber) {
} uni.makePhoneCall({
} phoneNumber
</script> })
}
<style> }
/* #ifndef APP-NVUE */ }
.uni-link { </script>
cursor: pointer;
} <style>
/* #ifndef APP-NVUE */
/* #endif */ .uni-link {
.uni-link--withline { cursor: pointer;
text-decoration: underline; }
}
</style> /* #endif */
.uni-link--withline {
text-decoration: underline;
}
</style>
{ {
"id": "uni-link", "id": "uni-link",
"displayName": "uni-link 超链接", "displayName": "uni-link 超链接",
"version": "0.0.5", "version": "0.0.6",
"description": "uni-link是一个外部网页超链接组件,在小程序内复制url,在app内打开外部浏览器,在h5端打", "description": "uni-link是一个外部网页超链接组件,在小程序内复制url,在app内打开外部浏览器,在h5端打",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
"uniui", "uniui",
"link", "link",
"超链接", "超链接",
"" ""
], ],
"repository": "https://github.com/dcloudio/uni-ui", "repository": "https://github.com/dcloudio/uni-ui",
"engines": { "engines": {
"HBuilderX": "" "HBuilderX": ""
}, },
"directories": { "directories": {
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [ "category": [
"前端组件", "前端组件",
"通用组件" "通用组件"
], ],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
}, },
"sourcecode": { "sourcecode": {
"price": "0.00" "price": "0.00"
} }
}, },
"contact": { "contact": {
"qq": "" "qq": ""
}, },
"declaration": { "declaration": {
"ads": "无", "ads": "无",
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [], "dependencies": [],
"encrypt": [], "encrypt": [],
"platforms": { "platforms": {
"cloud": { "cloud": {
"tcb": "y", "tcb": "y",
"aliyun": "y" "aliyun": "y"
}, },
"client": { "client": {
"App": { "App": {
"app-vue": "y", "app-vue": "y",
"app-nvue": "y" "app-nvue": "y"
}, },
"H5-mobile": { "H5-mobile": {
"Safari": "y", "Safari": "y",
"Android Browser": "y", "Android Browser": "y",
"微信浏览器(Android)": "y", "微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y" "QQ浏览器(Android)": "y"
}, },
"H5-pc": { "H5-pc": {
"Chrome": "y", "Chrome": "y",
"IE": "y", "IE": "y",
"Edge": "y", "Edge": "y",
"Firefox": "y", "Firefox": "y",
"Safari": "y" "Safari": "y"
}, },
"小程序": { "小程序": {
"微信": "y", "微信": "y",
"阿里": "y", "阿里": "y",
"百度": "y", "百度": "y",
"字节跳动": "y", "字节跳动": "y",
"QQ": "y" "QQ": "y"
}, },
"快应用": { "快应用": {
"华为": "y", "华为": "y",
"联盟": "y" "联盟": "y"
} }
} }
} }
} }
} }
\ No newline at end of file
...@@ -29,12 +29,19 @@ uni-link是一个外部网页超链接组件,在小程序内复制url,在app ...@@ -29,12 +29,19 @@ uni-link是一个外部网页超链接组件,在小程序内复制url,在app
|:-: |:-: |:-: |:-: | |:-: |:-: |:-: |:-: |
|href |String |- |链接地址 | |href |String |- |链接地址 |
|text |String |- |显示文字 | |text |String |- |显示文字 |
|download |String |- |H5平台下载文件名 |
|showUnderLine|Boolean|true |是否显示下划线 | |showUnderLine|Boolean|true |是否显示下划线 |
|copyTips |String |已自动复制网址,请在手机浏览器里粘贴该网址 |在小程序端复制链接时的提示语 | |copyTips |String |已自动复制网址,请在手机浏览器里粘贴该网址 |在小程序端复制链接时的提示语 |
|color |String |#999999 |链接文字颜色 | |color |String |#999999 |链接文字颜色 |
|fontSize |String |14 |链接文字大小,单位px | |fontSize |String |14 |链接文字大小,单位px |
### Link Slots
|名称|说明|
|:-:|:-:|
|default|自定义内容,回覆盖原有的内容显示|
## 组件示例 ## 组件示例
......
## 1.1.1(2021-07-21) ## 1.1.2(2021-07-30)
- 修复 与其他组件嵌套使用时,点击失效的Bug - 优化 vue3下事件警告的问题
## 1.1.1(2021-07-21)
- 修复 与其他组件嵌套使用时,点击失效的Bug
## 1.1.0(2021-07-13) ## 1.1.0(2021-07-13)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.0.17(2021-05-12) ## 1.0.17(2021-05-12)
......
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
*/ */
export default { export default {
name: 'UniListChat', name: 'UniListChat',
emits:['click'],
props: { props: {
title: { title: {
type: String, type: String,
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
*/ */
export default { export default {
name: 'UniListItem', name: 'UniListItem',
emits:['click','switchChange'],
props: { props: {
direction: { direction: {
type: String, type: String,
...@@ -162,8 +163,7 @@ export default { ...@@ -162,8 +163,7 @@ export default {
default: true default: true
} }
}, },
// inject: ['list'], // inject: ['list'],
emits:['click'],
data() { data() {
return { return {
isFirstChild: false isFirstChild: false
......
{ {
"id": "uni-list", "id": "uni-list",
"displayName": "uni-list 列表", "displayName": "uni-list 列表",
"version": "1.1.1", "version": "1.1.2",
"description": "List 组件 ,帮助使用者快速构建列表。", "description": "List 组件 ,帮助使用者快速构建列表。",
"keywords": [ "keywords": [
"", "",
......
## 1.1.8(2021-05-12) ## 1.2.0(2021-07-30)
- 新增 组件示例地址 - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.1.8(2021-05-12)
- 新增 组件示例地址
## 1.1.7(2021-03-30) ## 1.1.7(2021-03-30)
- 修复 uni-load-more 在首页使用时,h5 平台报 'uni is not defined' 的 bug - 修复 uni-load-more 在首页使用时,h5 平台报 'uni is not defined' 的 bug
## 1.1.6(2021-02-05) ## 1.1.6(2021-02-05)
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
*/ */
export default { export default {
name: 'UniLoadMore', name: 'UniLoadMore',
emits:['clickLoadMore'],
props: { props: {
status: { status: {
// 上拉的状态:more-loading前;loading-loading中;noMore-没有更多了 // 上拉的状态:more-loading前;loading-loading中;noMore-没有更多了
......
{ {
"id": "uni-load-more", "id": "uni-load-more",
"displayName": "uni-load-more 加载更多", "displayName": "uni-load-more 加载更多",
"version": "1.1.8", "version": "1.2.0",
"description": "LoadMore 组件,常用在列表里面,做滚动加载使用。", "description": "LoadMore 组件,常用在列表里面,做滚动加载使用。",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
......
## 1.0.11(2021-05-12) ## 1.1.0(2021-07-30)
- 新增 组件示例地址 - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.0.11(2021-05-12)
- 新增 组件示例地址
## 1.0.10(2021-04-30) ## 1.0.10(2021-04-30)
- 修复 在nvue下fixed为true,宽度不能撑满的Bug - 修复 在nvue下fixed为true,宽度不能撑满的Bug
## 1.0.9(2021-04-21) ## 1.0.9(2021-04-21)
......
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
components: { components: {
statusBar statusBar
}, },
emits:['clickLeft','clickRight','clickTitle'],
props: { props: {
title: { title: {
type: String, type: String,
......
...@@ -5,13 +5,15 @@ ...@@ -5,13 +5,15 @@
</template> </template>
<script> <script>
var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px'
export default { export default {
name: 'UniStatusBar', name: 'UniStatusBar',
data() { data() {
return { return {
statusBarHeight: statusBarHeight statusBarHeight: 20
} }
},
mounted() {
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px'
} }
} }
</script> </script>
......
{ {
"id": "uni-nav-bar", "id": "uni-nav-bar",
"displayName": "uni-nav-bar 自定义导航栏", "displayName": "uni-nav-bar 自定义导航栏",
"version": "1.0.11", "version": "1.1.0",
"description": "自定义导航栏组件,主要用于头部导航。", "description": "自定义导航栏组件,主要用于头部导航。",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
"uniui", "导航",
"title", "导航栏",
"自定义导航栏" "自定义导航栏"
], ],
"repository": "https://github.com/dcloudio/uni-ui", "repository": "https://github.com/dcloudio/uni-ui",
......
## 1.0.9(2021-05-12) ## 1.1.0(2021-07-30)
- 新增 组件示例地址 - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.0.9(2021-05-12)
- 新增 组件示例地址
## 1.0.8(2021-04-21) ## 1.0.8(2021-04-21)
- 优化 添加依赖 uni-icons, 导入后自动下载依赖 - 优化 添加依赖 uni-icons, 导入后自动下载依赖
## 1.0.7(2021-02-05) ## 1.0.7(2021-02-05)
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
export default { export default {
name: 'UniNoticeBar', name: 'UniNoticeBar',
emits:['click','getmore','close'],
props: { props: {
text: { text: {
type: String, type: String,
......
{ {
"id": "uni-notice-bar", "id": "uni-notice-bar",
"displayName": "uni-notice-bar 通告栏", "displayName": "uni-notice-bar 通告栏",
"version": "1.0.9", "version": "1.1.0",
"description": "NoticeBar 通告栏组件,常用于展示公告信息,可设为滚动公告", "description": "NoticeBar 通告栏组件,常用于展示公告信息,可设为滚动公告",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
......
## 1.1.0(2021-07-13) ## 1.1.1(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 优化 vue3下事件警告的问题
## 1.1.0(2021-07-13)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.0.7(2021-05-12) ## 1.0.7(2021-05-12)
- 新增 组件示例地址 - 新增 组件示例地址
## 1.0.6(2021-04-20) ## 1.0.6(2021-04-20)
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
export default { export default {
name: "UniNumberBox", name: "UniNumberBox",
emits:['change','input','update:modelValue','blur','focus'],
props: { props: {
value: { value: {
type: [Number, String], type: [Number, String],
......
{ {
"id": "uni-number-box", "id": "uni-number-box",
"displayName": "uni-number-box 数字输入框", "displayName": "uni-number-box 数字输入框",
"version": "1.1.0", "version": "1.1.1",
"description": "NumberBox 带加减按钮的数字输入框组件,用户可以控制每次点击增加的数值,支持小数。", "description": "NumberBox 带加减按钮的数字输入框组件,用户可以控制每次点击增加的数值,支持小数。",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
......
## 1.0.7(2021-05-12) ## 1.1.0(2021-07-30)
- 新增 组件示例地址 - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.0.7(2021-05-12)
- 新增 组件示例地址
## 1.0.6(2021-04-12) ## 1.0.6(2021-04-12)
- 新增 PC 和 移动端适配不同的 ui - 新增 PC 和 移动端适配不同的 ui
## 1.0.5(2021-02-05) ## 1.0.5(2021-02-05)
......
...@@ -70,11 +70,16 @@ ...@@ -70,11 +70,16 @@
export default { export default {
name: 'UniPagination', name: 'UniPagination',
emits:['update:modelValue','input','change'],
props: { props: {
value: { value: {
type: [Number, String], type: [Number, String],
default: 1 default: 1
}, },
modelValue: {
type: [Number, String],
default: 1
},
prevText: { prevText: {
type: String, type: String,
default: '上一页' default: '上一页'
...@@ -185,6 +190,13 @@ export default { ...@@ -185,6 +190,13 @@ export default {
} else { } else {
this.currentIndex = val this.currentIndex = val
} }
},
modelValue(val) {
if (val < 1) {
this.currentIndex = 1
} else {
this.currentIndex = val
}
} }
}, },
created() { created() {
...@@ -235,6 +247,7 @@ export default { ...@@ -235,6 +247,7 @@ export default {
}, },
change(e) { change(e) {
this.$emit('input', this.currentIndex) this.$emit('input', this.currentIndex)
this.$emit('update:modelValue', this.currentIndex)
this.$emit('change', { this.$emit('change', {
type: e, type: e,
current: this.currentIndex current: this.currentIndex
......
{ {
"id": "uni-pagination", "id": "uni-pagination",
"displayName": "uni-pagination 分页器", "displayName": "uni-pagination 分页器",
"version": "1.0.7", "version": "1.1.0",
"description": "Pagination 分页器组件,用于展示页码、请求数据等。", "description": "Pagination 分页器组件,用于展示页码、请求数据等。",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册