Skip to content

Commit

Permalink
1.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
imouou committed Mar 31, 2019
1 parent 5657573 commit 9c5bcc8
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 56 deletions.
22 changes: 18 additions & 4 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## 目录
[TOC]

## 1.5.2 20190321
## 1.5.2 20190328

### 升级指南

Expand All @@ -26,8 +26,9 @@ $ buijs update -p appcan
```

### 重要更新
link轻应用在安卓9,在打开第2次的时候,会出现获取不到宽高的情况, 之前bui.on("pageinit") 执行的初始化,不再生效, 需要在 bui.ready 里面. 建议更新 bui.css bui.js .
link轻应用在安卓9,在打开第2次的时候,会出现获取不到宽高的情况. 建议更新 bui.css bui.js .

### bui 工程新增二维码,手机扫码即可预览效果. 确保手机跟电脑在同一个wifi下.

### bui.css 更新
1. bui-box-reverse 的反序修复
Expand All @@ -46,7 +47,7 @@ link轻应用在安卓9,在打开第2次的时候,会出现获取不到宽高的
2. 新增html模板的加载

### bui.router
1. bui.getPartParams 的传参问题, 之前必须接收一个id, 现在不用,可以拿到当前加载的id的参数
1. bui.getPartParams 的传参问题, 之前必须接收一个id, 现在不用,可以拿到当前加载的id的参数

### bui.store
1. 新增 b-children 配合 b-template 模板使用, 应对复杂模板的情况
Expand All @@ -65,7 +66,11 @@ link轻应用在安卓9,在打开第2次的时候,会出现获取不到宽高的
3. 修改 轮播图,标题轮播图,跨屏轮播,公告为动态渲染例子,简化使用方式.
4. 新增 相册简单效果

### bui.tab
### bui.scroll
1. 新增 onBeforeRefresh 参数
2. 新增 onBeforeLoad 参数

### bui.tab
1. 新增 template 参数, 支持数据动态自定义

### bui.levelselect
Expand All @@ -75,6 +80,8 @@ link轻应用在安卓9,在打开第2次的时候,会出现获取不到宽高的
1. 调用init 以后重复初始化loading问题
2. 修复数据返回对象,数组却是字符串的奇葩格式问题
3. 在tab里面的高度不准确问题
4. 新增 onBeforeRefresh 参数
5. 新增 onBeforeLoad 参数

### bui.loading
1. 允许一个容器下有多个进度条, 便于用户对进度条的灵活控制.
Expand All @@ -88,6 +95,13 @@ link轻应用在安卓9,在打开第2次的时候,会出现获取不到宽高的
### bui.dropdown
1. 修复 reset 方法以后还能获取到值的问题

### bui.number
1. 新增静态属性 max, min 在input. 便于每个number有自己单独的大小

### bui.select
1. 新增disabledSelect, enabledSelect 方法, 来控制某些元素不允许通过点击选择
2. 新增unactive, unselected 方法

### bui.array
1. 新增get 方法,获取该值是否存在, 存在返回当前值或对象
2. 新增getAll 获取该数组里面所有符合的对象, 返回数组
Expand Down
36 changes: 31 additions & 5 deletions docs/chapter1/installation.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# 安装

## 开发环境
?> 你可能只需要一个系统自带的编辑器,就可以使用BUI开发应用, 但通过以下软件相互配合,对开发效率会有一定的帮助.
?> 你可能只需要一个系统自带的编辑器,就可以使用BUI开发应用, 但通过以下软件相互配合,对开发效率会有一定的帮助.

1. 编辑器 ( 推荐: `vscode`, `Atom``Sublimetext3` );
2. `bui-fast` [点击下载](https://github.com/imouou/BUI-Fast-Snippets/releases) (配合编辑器快速书写插件, 支持 Vscode, Atom , Sublimetext , Webstorm , APICloudIDE ) [查看安装说明](tools/buifast.md);
2. `bui-fast` [点击下载](https://github.com/imouou/BUI-Fast-Snippets/releases) (配合编辑器快速书写插件, 支持 Vscode, Atom , Sublimetext , Webstorm , APICloudIDE ) [查看安装说明](tools/buifast.md);

## 下载开发包

!> 用过npm, 我们推荐您学习使用[buijs](tools/buijs.md)`自动化构建`, 自动化构建默认是最新的`bui`版本.
!> 用过npm, 我们推荐您学习使用[buijs](tools/buijs.md)`自动化构建`, 自动化构建默认是最新的`bui`版本.

- [下载BUI单页开发包](http://www.easybui.com/downloads/source/bui/bui_router_dev_latest.zip)

Expand All @@ -23,7 +23,9 @@

## 部署运行

第1种, 解压,进入工程目录, 通过这种运行,里面可以配置域名代理,解决移动端调试的跨域问题. 生成的`dist目录`为最终要打包的目录, src 保持源文件的方式.
第1种, 通过npm

?> 解压,进入工程目录, 通过这种运行, `app.json`可以配置域名代理,解决移动端调试的跨域问题. 生成的`dist目录`为最终要打包的目录, src 保持源文件的方式.

```
# 安装依赖
Expand All @@ -32,5 +34,29 @@ $ npm install
$ npm run dev
```

第2种, 把src 目录放在 IIS 或者 phpstudy 之类的服务器, 运行就能直接观看效果.
!> 注意, windows的开发者,如果报错, 可以尝试安装[cnpm](https://npm.taobao.org/), 使用 `cnpm install` 安装依赖.
另一个报错的原因是, [node-sass](https://github.com/sass/node-sass) 版本跟你的 [node](https://nodejs.org/en/) 版本不一致, 建议下载[node 8.x](https://nodejs.org/dist/v8.15.1/). 如果你下载的 node 是`10.15.3 LTS`. `node-sass` 的版本要在 4.9+ , 需要先`npm remove node-sass` 再安装指定版本.

| **NodeJS** | **Minimum node-sass version** |
|:--------------------|---------------:|
| Node 11 |4.10+ |
| Node 10 |4.9+ |
| Node 8 |4.5.3+ |


第2种: 使用yarn安装

?> 这种方式比Npm 要稳定,报错的概率较小. 通过[yarn](https://yarnpkg.com/lang/zh-hans/docs/install/)安装, 需要先安装`yarn`.

```
# 安装依赖
$ yarn install
# 调试的时候
$ yarn run dev
# 打包的时候执行
$ yarn run build
```

第3种, 把src 目录放在 IIS 或者 phpstudy 之类的服务器, 运行就能直接观看效果, 但是需要解决浏览器跨域问题, [Chrome跨域调试](chapter1/debug.md).
9 changes: 9 additions & 0 deletions docs/controls/main/tab.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,12 @@

## 多层嵌套选项卡
<iframe width="100%" height="560" src="http://www.easybui.com/demo/source.html?url=pages/ui_controls/bui.tab_foot_tab&code=html,js, result" allowfullscreen="allowfullscreen" frameborder="0"></iframe>


## 选项卡动态渲染 1.5.2

<iframe width="100%" height="560" src="http://www.easybui.com/demo/source.html?url=pages/ui_controls/bui.tab_dynamic_data&code=html,js,result" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

## 纵向选项卡动态渲染 1.5.2

<iframe width="100%" height="560" src="http://www.easybui.com/demo/source.html?url=pages/ui_controls/bui.tab_side_dynamic&code=html,js,result" allowfullscreen="allowfullscreen" frameborder="0"></iframe>
94 changes: 47 additions & 47 deletions docs/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,34 @@
* Register service worker.
* ========================================================== */

const RUNTIME = 'bui-guide1.5.00'
const RUNTIME = 'bui-guide1.5.20'
const HOSTNAME_WHITELIST = [
self.location.hostname,
'fonts.gstatic.com',
'fonts.googleapis.com',
'unpkg.com'
self.location.hostname,
'fonts.gstatic.com',
'fonts.googleapis.com',
'unpkg.com'
]

// The Util Function to hack URLs of intercepted requests
const getFixedUrl = (req) => {
var now = Date.now()
var url = new URL(req.url)
var now = Date.now()
var url = new URL(req.url)

// 1. fixed http URL
// Just keep syncing with location.protocol
// fetch(httpURL) belongs to active mixed content.
// And fetch(httpRequest) is not supported yet.
url.protocol = self.location.protocol
// 1. fixed http URL
// Just keep syncing with location.protocol
// fetch(httpURL) belongs to active mixed content.
// And fetch(httpRequest) is not supported yet.
url.protocol = self.location.protocol

// 2. add query for caching-busting.
// Github Pages served with Cache-Control: max-age=600
// max-age on mutable content is error-prone, with SW life of bugs can even extend.
// Until cache mode of Fetch API landed, we have to workaround cache-busting with query string.
// Cache-Control-Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=453190
if (url.hostname === self.location.hostname) {
url.search += (url.search ? '&' : '?') + 'cache-bust=' + now
}
return url.href
// 2. add query for caching-busting.
// Github Pages served with Cache-Control: max-age=600
// max-age on mutable content is error-prone, with SW life of bugs can even extend.
// Until cache mode of Fetch API landed, we have to workaround cache-busting with query string.
// Cache-Control-Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=453190
if (url.hostname === self.location.hostname) {
url.search += (url.search ? '&' : '?') + 'cache-bust=' + now
}
return url.href
}

/**
Expand All @@ -43,7 +43,7 @@ const getFixedUrl = (req) => {
* waitUntil(): activating ====> activated
*/
self.addEventListener('activate', event => {
event.waitUntil(self.clients.claim())
event.waitUntil(self.clients.claim())
})

/**
Expand All @@ -53,31 +53,31 @@ self.addEventListener('activate', event => {
* void respondWith(Promise<Response> r)
*/
self.addEventListener('fetch', event => {
// Skip some of cross-origin requests, like those for Google Analytics.
if (HOSTNAME_WHITELIST.indexOf(new URL(event.request.url).hostname) > -1) {
// Stale-while-revalidate
// similar to HTTP's stale-while-revalidate: https://www.mnot.net/blog/2007/12/12/stale
// Upgrade from Jake's to Surma's: https://gist.github.com/surma/eb441223daaedf880801ad80006389f1
const cached = caches.match(event.request)
const fixedUrl = getFixedUrl(event.request)
const fetched = fetch(fixedUrl, { cache: 'no-store' })
const fetchedCopy = fetched.then(resp => resp.clone())
// Skip some of cross-origin requests, like those for Google Analytics.
if (HOSTNAME_WHITELIST.indexOf(new URL(event.request.url).hostname) > -1) {
// Stale-while-revalidate
// similar to HTTP's stale-while-revalidate: https://www.mnot.net/blog/2007/12/12/stale
// Upgrade from Jake's to Surma's: https://gist.github.com/surma/eb441223daaedf880801ad80006389f1
const cached = caches.match(event.request)
const fixedUrl = getFixedUrl(event.request)
const fetched = fetch(fixedUrl, { cache: 'no-store' })
const fetchedCopy = fetched.then(resp => resp.clone())

// Call respondWith() with whatever we get first.
// If the fetch fails (e.g disconnected), wait for the cache.
// If there’s nothing in cache, wait for the fetch.
// If neither yields a response, return offline pages.
event.respondWith(
Promise.race([fetched.catch(_ => cached), cached])
.then(resp => resp || fetched)
.catch(_ => { /* eat any errors */ })
)
// Call respondWith() with whatever we get first.
// If the fetch fails (e.g disconnected), wait for the cache.
// If there’s nothing in cache, wait for the fetch.
// If neither yields a response, return offline pages.
event.respondWith(
Promise.race([fetched.catch(_ => cached), cached])
.then(resp => resp || fetched)
.catch(_ => { /* eat any errors */ })
)

// Update the cache with the version we fetched (only for ok status)
event.waitUntil(
Promise.all([fetchedCopy, caches.open(RUNTIME)])
.then(([response, cache]) => response.ok && cache.put(event.request, response))
.catch(_ => { /* eat any errors */ })
)
}
// Update the cache with the version we fetched (only for ok status)
event.waitUntil(
Promise.all([fetchedCopy, caches.open(RUNTIME)])
.then(([response, cache]) => response.ok && cache.put(event.request, response))
.catch(_ => { /* eat any errors */ })
)
}
})

0 comments on commit 9c5bcc8

Please sign in to comment.