Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/components/side-nav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@
if (xhr.readyState === 4 && xhr.status === 200) {
const {data: navs} = JSON.parse(xhr.responseText);
this.femessageNavs = navs.map(nav => {
nav.url = `https://serverless.deepexi.top/serverless-console/index.html#/material/${nav.repoName}`;
nav.url = `https://static.deepexi.top/serverless-console/index.html#/material/${nav.repoName}`;
return nav;
}).filter(nav => nav.lib && nav.lib.indexOf('element') > -1);
}
Expand Down
28 changes: 13 additions & 15 deletions examples/docs/zh-CN/edit-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -516,15 +516,21 @@ export default {
:::demo

```html
<el-button @click="onSyncUpdate">异步更新</el-button>
<el-button @click="onSyncUpdate">Append</el-button>
<el-button @click="onSetOptions">SetOptions</el-button>
<el-edit-table ref="form" :columns="columns" v-model="data"></el-edit-table>

<script>
export default {
data() {
return {
data: [],
id: 1,
data: [
{
id: `第 1 行`,
option: '',
},
],
columns: [
{
id: 'id',
Expand All @@ -549,20 +555,12 @@ export default {
},
methods: {
onSyncUpdate() {
this.data = [
{
id: '第 1 行',
for (let i = 0; i < 3; i++) {
this.data.push({
id: `第 ${++this.id} 行`,
option: '',
},
{
id: '第 2 行',
option: '',
},
{
id: '第 3 行',
option: '',
},
]
})
}
},
onSetOptions() {
this.data.forEach((e, i) => {
Expand Down
34 changes: 32 additions & 2 deletions examples/docs/zh-CN/message-box.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
this.$message({
type: 'info',
message: '已取消删除'
});
});
});
}
}
Expand Down Expand Up @@ -101,7 +101,7 @@
this.$message({
type: 'info',
message: '取消输入'
});
});
});
}
}
Expand Down Expand Up @@ -273,6 +273,35 @@
```
:::

### 实例插入位置
支持实例插入文档位置

:::demo 将 `appendTarget` 设置为 要插入的位置 即可

```html
<template>
<div ref="target" id="target">
<el-button type="text" @click="open">点击打开 Message Box</el-button>
</div>
</template>

<script>
export default {
methods: {
open() {
this.$confirm('打开控制台查看插入的位置', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
center: true,
appendTarget: this.$refs.target // '#target'
})
}
}
}
</script>
```
:::

### 全局方法

如果你完整引入了 Element,它会为 Vue.prototype 添加如下全局方法:$msgbox, $alert, $confirm 和 $prompt。因此在 Vue instance 中可以采用本页面中的方式调用 `MessageBox`。调用参数为:
Expand Down Expand Up @@ -324,3 +353,4 @@ import { MessageBox } from 'element-ui';
| inputErrorMessage | 校验未通过时的提示文本 | string | — | 输入的数据不合法! |
| center | 是否居中布局 | boolean | — | false |
| roundButton | 是否使用圆角按钮 | boolean | — | false |
| appendTarget | 实例插入文档的目标位置 | HTMLElement / string | — | document.body |
60 changes: 60 additions & 0 deletions examples/docs/zh-CN/select.md
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,65 @@
```
:::

### 扩展插槽

选项列表底部扩展内容
:::demo 扩展插槽可以插入自己需要的功能按钮。
```html
<template>
  <div>
    <el-select v-model="value" placeholder="请选择">
      <el-option
        v-for="item in cities"
        :key="item.value"
        :label="item.label"
        :value="item.value">
      </el-option>
      <div slot="extra">
        <el-button type="text" @click="handleRefresh" style="width: 100%;">
刷新城市列表
</el-button>
      </div>
    </el-select>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        cities: [{
          value: 'Beijing',
          label: '北京'
        }, {
          value: 'Shanghai',
          label: '上海'
        }, {
          value: 'Nanjing',
          label: '南京'
        }, {
          value: 'Chengdu',
          label: '成都'
        }, {
          value: 'Shenzhen',
          label: '深圳'
        }, {
          value: 'Guangzhou',
          label: '广州'
        }],
        value: ''
      };
    },
    methods: {
      handleRefresh() {
        // 重新请求获取 cities 数据
      },
    }
  }
</script>
```
:::

:::tip
如果 Select 的绑定值为对象类型,请务必指定 `value-key` 作为它的唯一性标识。
:::
Expand Down Expand Up @@ -565,6 +624,7 @@
| — | Option 组件列表 |
| prefix | Select 组件头部内容 |
| empty | 无选项时的列表 |
| extra | 选项列表底部扩展内容 |

### Option Group Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
Expand Down
4 changes: 2 additions & 2 deletions examples/docs/zh-CN/switch-enhance.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
```html
<el-switch-enhance
v-model="value1"
:width="85"
:width="77"
inline-text
active-text="按月付费"
inactive-text="按年付费"
Expand All @@ -55,7 +55,7 @@ export default {
v-model="value2"
square
inline-text
:width="70"
:width="67"
active-text="已启用"
inactive-text="已关闭"
/>
Expand Down
17 changes: 17 additions & 0 deletions netlify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
echo "is netlify: $NETLIFY"
echo "in branch: $BRANCH"
echo "head: $HEAD"

if [ "$NETLIFY" != "true" ]
then
echo "this script only runs in netlify, bye"
exit 1
fi

if [ "$BRANCH" != "dev" ] && [ "$HEAD" != "dev" ]
then
yarn build:file && yarn deploy:build
else
echo "this script only runs in targeting dev's PR deploy preview, bye"
fi
3 changes: 2 additions & 1 deletion packages/edit-table/src/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ export default {
value(v) {
this.resetRowOptionsData(v, this.oldValue);

this.oldValue = [...v];

this.indexKeys = v.map((_, i) => i);
}
},
Expand Down Expand Up @@ -207,7 +209,6 @@ export default {
},

updateValue(value) {
this.oldValue = [...this.model.data];
this.$emit('input', value);
},

Expand Down
17 changes: 15 additions & 2 deletions packages/message-box/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ const defaults = {
dangerouslyUseHTMLString: false,
center: false,
roundButton: false,
distinguishCancelAndClose: false
distinguishCancelAndClose: false,
appendTarget: null
};

import Vue from 'vue';
Expand All @@ -43,6 +44,18 @@ const MessageBoxConstructor = Vue.extend(msgboxVue);
let currentMsg, instance;
let msgQueue = [];

const getAppendTarget = (target) => {
if (!target) {
return document.body;
}
if (typeof target === 'string') {
return document.querySelector(target);
}
if (target instanceof HTMLElement) {
return target;
}
};

const defaultCallback = action => {
if (currentMsg) {
let callback = currentMsg.callback;
Expand Down Expand Up @@ -111,7 +124,7 @@ const showNextMsg = () => {
instance[prop] = true;
}
});
document.body.appendChild(instance.$el);
getAppendTarget(options.appendTarget).appendChild(instance.$el);

Vue.nextTick(() => {
instance.visible = true;
Expand Down
3 changes: 3 additions & 0 deletions packages/select/src/select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@
</el-option>
<slot></slot>
</el-scrollbar>
<template v-if="$slots.extra">
<slot name="extra"></slot>
</template>
<template v-if="emptyText && (!allowCreate || loading || (allowCreate && options.length === 0 ))">
<slot name="empty" v-if="$slots.empty"></slot>
<p class="el-select-dropdown__empty" v-else>
Expand Down
9 changes: 9 additions & 0 deletions packages/theme-chalk/src/switch-enhance.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
margin: 0;
opacity: 0;
visibility: hidden;

& span {
font-size: 12px;
}
}

.el-switch__label.is-active {
Expand All @@ -34,5 +38,10 @@
.el-switch__label--right {
left: 6px;
}

&:not(.is-checked) .el-switch__core {
background-color: #A7A8AD;
border-color: #A7A8AD;
}
}
}