File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 288288 if (xhr .readyState === 4 && xhr .status === 200 ) {
289289 const {data: navs } = JSON .parse (xhr .responseText );
290290 this .femessageNavs = navs .map (nav => {
291- nav .url = ` https://serverless .deepexi.top/serverless-console/index.html#/material/${ nav .repoName } ` ;
291+ nav .url = ` https://static .deepexi.top/serverless-console/index.html#/material/${ nav .repoName } ` ;
292292 return nav;
293293 }).filter (nav => nav .lib && nav .lib .indexOf (' element' ) > - 1 );
294294 }
Original file line number Diff line number Diff line change @@ -516,15 +516,21 @@ export default {
516516::: demo
517517
518518``` html
519- <el-button @click =" onSyncUpdate" >异步更新 </el-button >
519+ <el-button @click =" onSyncUpdate" >Append </el-button >
520520<el-button @click =" onSetOptions" >SetOptions</el-button >
521521<el-edit-table ref =" form" :columns =" columns" v-model =" data" ></el-edit-table >
522522
523523<script >
524524 export default {
525525 data () {
526526 return {
527- data: [],
527+ id: 1 ,
528+ data: [
529+ {
530+ id: ` 第 1 行` ,
531+ option: ' ' ,
532+ },
533+ ],
528534 columns: [
529535 {
530536 id: ' id' ,
@@ -549,20 +555,12 @@ export default {
549555 },
550556 methods: {
551557 onSyncUpdate () {
552- this . data = [
553- {
554- id: ' 第 1 行 ' ,
558+ for ( let i = 0 ; i < 3 ; i ++ ) {
559+ this . data . push ( {
560+ id: ` 第 ${ ++ this . id } 行 ` ,
555561 option: ' ' ,
556- },
557- {
558- id: ' 第 2 行' ,
559- option: ' ' ,
560- },
561- {
562- id: ' 第 3 行' ,
563- option: ' ' ,
564- },
565- ]
562+ })
563+ }
566564 },
567565 onSetOptions () {
568566 this .data .forEach ((e , i ) => {
Original file line number Diff line number Diff line change 6363 this .$message ({
6464 type: ' info' ,
6565 message: ' 已取消删除'
66- });
66+ });
6767 });
6868 }
6969 }
101101 this .$message ({
102102 type: ' info' ,
103103 message: ' 取消输入'
104- });
104+ });
105105 });
106106 }
107107 }
273273```
274274:::
275275
276+ ### 实例插入位置
277+ 支持实例插入文档位置
278+
279+ :::demo 将 ` appendTarget ` 设置为 要插入的位置 即可
280+
281+ ``` html
282+ <template >
283+ <div ref =" target" id =" target" >
284+ <el-button type =" text" @click =" open" >点击打开 Message Box</el-button >
285+ </div >
286+ </template >
287+
288+ <script >
289+ export default {
290+ methods: {
291+ open () {
292+ this .$confirm (' 打开控制台查看插入的位置' , ' 提示' , {
293+ confirmButtonText: ' 确定' ,
294+ cancelButtonText: ' 取消' ,
295+ center: true ,
296+ appendTarget: this .$refs .target // '#target'
297+ })
298+ }
299+ }
300+ }
301+ </script >
302+ ```
303+ :::
304+
276305### 全局方法
277306
278307如果你完整引入了 Element,它会为 Vue.prototype 添加如下全局方法:$msgbox, $alert, $confirm 和 $prompt。因此在 Vue instance 中可以采用本页面中的方式调用 ` MessageBox ` 。调用参数为:
@@ -324,3 +353,4 @@ import { MessageBox } from 'element-ui';
324353| inputErrorMessage | 校验未通过时的提示文本 | string | — | 输入的数据不合法! |
325354| center | 是否居中布局 | boolean | — | false |
326355| roundButton | 是否使用圆角按钮 | boolean | — | false |
356+ | appendTarget | 实例插入文档的目标位置 | HTMLElement / string | — | document.body |
Original file line number Diff line number Diff line change 515515```
516516:::
517517
518+ ### 扩展插槽
519+
520+ 选项列表底部扩展内容
521+ :::demo 扩展插槽可以插入自己需要的功能按钮。
522+ ``` html
523+ <template >
524+ <div >
525+ <el-select v-model =" value" placeholder =" 请选择" >
526+ <el-option
527+ v-for =" item in cities"
528+ :key =" item.value"
529+ :label =" item.label"
530+ :value =" item.value" >
531+ </el-option >
532+ <div slot =" extra" >
533+ <el-button type =" text" @click =" handleRefresh" style =" width : 100% ;" >
534+ 刷新城市列表
535+ </el-button >
536+ </div >
537+ </el-select >
538+ </div >
539+ </template >
540+
541+ <script >
542+ export default {
543+ data () {
544+ return {
545+ cities: [{
546+ value: ' Beijing' ,
547+ label: ' 北京'
548+ }, {
549+ value: ' Shanghai' ,
550+ label: ' 上海'
551+ }, {
552+ value: ' Nanjing' ,
553+ label: ' 南京'
554+ }, {
555+ value: ' Chengdu' ,
556+ label: ' 成都'
557+ }, {
558+ value: ' Shenzhen' ,
559+ label: ' 深圳'
560+ }, {
561+ value: ' Guangzhou' ,
562+ label: ' 广州'
563+ }],
564+ value: ' '
565+ };
566+ },
567+ methods: {
568+ handleRefresh () {
569+ // 重新请求获取 cities 数据
570+ },
571+ }
572+ }
573+ </script >
574+ ```
575+ :::
576+
518577::: tip
519578如果 Select 的绑定值为对象类型,请务必指定 ` value-key ` 作为它的唯一性标识。
520579:::
565624| — | Option 组件列表 |
566625| prefix | Select 组件头部内容 |
567626| empty | 无选项时的列表 |
627+ | extra | 选项列表底部扩展内容 |
568628
569629### Option Group Attributes
570630| 参数 | 说明 | 类型 | 可选值 | 默认值 |
Original file line number Diff line number Diff line change 2828``` html
2929<el-switch-enhance
3030 v-model =" value1"
31- :width =" 85 "
31+ :width =" 77 "
3232 inline-text
3333 active-text =" 按月付费"
3434 inactive-text =" 按年付费"
@@ -55,7 +55,7 @@ export default {
5555 v-model =" value2"
5656 square
5757 inline-text
58- :width =" 70 "
58+ :width =" 67 "
5959 active-text =" 已启用"
6060 inactive-text =" 已关闭"
6161/>
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ echo " is netlify: $NETLIFY "
3+ echo " in branch: $BRANCH "
4+ echo " head: $HEAD "
5+
6+ if [ " $NETLIFY " != " true" ]
7+ then
8+ echo " this script only runs in netlify, bye"
9+ exit 1
10+ fi
11+
12+ if [ " $BRANCH " != " dev" ] && [ " $HEAD " != " dev" ]
13+ then
14+ yarn build:file && yarn deploy:build
15+ else
16+ echo " this script only runs in targeting dev's PR deploy preview, bye"
17+ fi
Original file line number Diff line number Diff line change @@ -171,6 +171,8 @@ export default {
171171 value (v ) {
172172 this .resetRowOptionsData (v, this .oldValue );
173173
174+ this .oldValue = [... v];
175+
174176 this .indexKeys = v .map ((_ , i ) => i);
175177 }
176178 },
@@ -207,7 +209,6 @@ export default {
207209 },
208210
209211 updateValue (value ) {
210- this .oldValue = [... this .model .data ];
211212 this .$emit (' input' , value);
212213 },
213214
Original file line number Diff line number Diff line change @@ -30,7 +30,8 @@ const defaults = {
3030 dangerouslyUseHTMLString : false ,
3131 center : false ,
3232 roundButton : false ,
33- distinguishCancelAndClose : false
33+ distinguishCancelAndClose : false ,
34+ appendTarget : null
3435} ;
3536
3637import Vue from 'vue' ;
@@ -43,6 +44,18 @@ const MessageBoxConstructor = Vue.extend(msgboxVue);
4344let currentMsg , instance ;
4445let msgQueue = [ ] ;
4546
47+ const getAppendTarget = ( target ) => {
48+ if ( ! target ) {
49+ return document . body ;
50+ }
51+ if ( typeof target === 'string' ) {
52+ return document . querySelector ( target ) ;
53+ }
54+ if ( target instanceof HTMLElement ) {
55+ return target ;
56+ }
57+ } ;
58+
4659const defaultCallback = action => {
4760 if ( currentMsg ) {
4861 let callback = currentMsg . callback ;
@@ -111,7 +124,7 @@ const showNextMsg = () => {
111124 instance [ prop ] = true ;
112125 }
113126 } ) ;
114- document . body . appendChild ( instance . $el ) ;
127+ getAppendTarget ( options . appendTarget ) . appendChild ( instance . $el ) ;
115128
116129 Vue . nextTick ( ( ) => {
117130 instance . visible = true ;
Original file line number Diff line number Diff line change 122122 </el-option >
123123 <slot ></slot >
124124 </el-scrollbar >
125+ <template v-if =" $slots .extra " >
126+ <slot name =" extra" ></slot >
127+ </template >
125128 <template v-if =" emptyText && (! allowCreate || loading || (allowCreate && options .length === 0 ))" >
126129 <slot name =" empty" v-if =" $slots.empty" ></slot >
127130 <p class =" el-select-dropdown__empty" v-else >
Original file line number Diff line number Diff line change 1818 margin : 0 ;
1919 opacity : 0 ;
2020 visibility : hidden ;
21+
22+ & span {
23+ font-size : 12px ;
24+ }
2125 }
2226
2327 .el-switch__label.is-active {
3438 .el-switch__label--right {
3539 left : 6px ;
3640 }
41+
42+ & :not (.is-checked ) .el-switch__core {
43+ background-color : #A7A8AD ;
44+ border-color : #A7A8AD ;
45+ }
3746 }
3847}
You can’t perform that action at this time.
0 commit comments