Commit afdb808d by luyt

feat:添加GLImage组件

1 parent 94be8501
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
...@@ -71,6 +71,10 @@ ...@@ -71,6 +71,10 @@
title: 'GLTableOption', title: 'GLTableOption',
link: '/components/GLTableOption' link: '/components/GLTableOption'
}, },
{
title: 'GLImage',
link: '/components/GLImage'
},
] ]
}, },
{ {
......
...@@ -221,6 +221,13 @@ ...@@ -221,6 +221,13 @@
<i class="gl-icon-pause"></i> <i class="gl-icon-pause"></i>
<i class="gl-icon-icon-full-screen"></i> <i class="gl-icon-icon-full-screen"></i>
<hr /> <hr />
<!-- 测试GLImage -->
<GLImage
style="width: 100px; height: 100px"
:src="url"
:preview-src-list="srcList"
:appendToBody="false"
></GLImage>
</div> </div>
</template> </template>
<script> <script>
...@@ -846,6 +853,12 @@ export default { ...@@ -846,6 +853,12 @@ export default {
order: 2 //数值越大越靠前 order: 2 //数值越大越靠前
}, },
], ],
// 测试GLImage
url: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
srcList: [
'https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg',
'https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg'
]
} }
}, },
mounted() { mounted() {
......
import GLImage from './src/index.vue'
// 为组件提供 install 安装方法,供按需引入
GLImage.install = function(Vue) {
Vue.component(GLImage.name, GLImage)
}
// 默认导出组件
export default GLImage
\ No newline at end of file \ No newline at end of file
<!-- <content> -->
<GLImage style="width: 100px; height: 100px" :src="url" :preview-src-list="srcList"></GLImage>
<el-button type="warning" @click="toggleShow(1)">显示代码</el-button>
```js {mixin:true}
{
data() {
return {
demo1: true,
// 测试GLImage
url: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
srcList: [
'https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg',
'https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg'
]
}
},
methods:{
btnClick(){
alert('点击')
},
toggleShow(num){
// console.log(123)
this['demo' + num] = !this['demo' + num]
}
}
}
```
# 用来作为 markdown 代码的示例部分
<div v-if="demo1">
```html
<template>
<GLImage
style="width: 100px; height: 100px"
:src="url"
:preview-src-list="srcList"
:appendToBody="false"
></GLImage>
</template>
<script>
export default {
data() {
return {
// 测试GLImage
url: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
srcList: [
'https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg',
'https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg'
]
}
},
methods: {
// btnClick() {
// alert('点击')
// }
}
}
</script>
```
</div>
<!-- </content> -->
<script>
export default {
name: 'GLImage',
functional: true,
render: function(createElement, context) {
return createElement(
'el-image',
{
...context.data,
'class':{
...context.data.class,
'gl-image':true
}
},
context.children
)
}
}
</script>
<style lang="scss">
</style>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
// 导入颜色选择器组件 // 导入颜色选择器组件
// import '@/plugins/element.js' // import '@/plugins/element.js'
import { Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu, Dialog, MessageBox, Tabs, TabPane ,Checkbox,CheckboxGroup} from '@/plugins/element.js' import { Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu, Dialog, MessageBox, Tabs, TabPane ,Checkbox,CheckboxGroup,Image} from '@/plugins/element.js'
import '@/theme/theme.scss' import '@/theme/theme.scss'
// 一次性注册所有的过滤器 本地测试 // 一次性注册所有的过滤器 本地测试
...@@ -23,6 +23,7 @@ import GLCombiForm from './GlCombiForm' ...@@ -23,6 +23,7 @@ import GLCombiForm from './GlCombiForm'
import GLTableButton from './GlTableButton' import GLTableButton from './GlTableButton'
import GLTabs from './GLTabs' import GLTabs from './GLTabs'
import GLTableOption from './GLTableOption' import GLTableOption from './GLTableOption'
import GLImage from './GLImage'
// 导入业务组件 // 导入业务组件
import GLProvince from './GLProvince' import GLProvince from './GLProvince'
...@@ -32,13 +33,13 @@ import GLEditor from './Editor' ...@@ -32,13 +33,13 @@ import GLEditor from './Editor'
import GLBcTest from '@/bcPackages/GLBcTest' import GLBcTest from '@/bcPackages/GLBcTest'
//el原始组件 //el原始组件
const ElComponent = [Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu, Dialog, MessageBox, Tabs, TabPane,Checkbox,CheckboxGroup] const ElComponent = [Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu, Dialog, MessageBox, Tabs, TabPane,Checkbox,CheckboxGroup,Image]
// 业务组件导入列表 // 业务组件导入列表
const BcComponent = [GLBcTest] const BcComponent = [GLBcTest]
// 存储组件列表 // 存储组件列表
const components = [TestComp, GLExternal, GLButton, GLDialog, GLTable, GLFooter, GLSearch, GLSearchItem, GLCombiForm, GLTableButton, GLProvince, GLFull, GLEditor, GLTabs,GLTableOption].concat(ElComponent).concat(BcComponent) const components = [TestComp, GLExternal, GLButton, GLDialog, GLTable, GLFooter, GLSearch, GLSearchItem, GLCombiForm, GLTableButton, GLProvince, GLFull, GLEditor, GLTabs,GLTableOption,GLImage].concat(ElComponent).concat(BcComponent)
// console.log('components: ', components); // console.log('components: ', components);
// 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册 // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
...@@ -91,6 +92,7 @@ export default { ...@@ -91,6 +92,7 @@ export default {
GLCombiForm, GLCombiForm,
GLTableButton, GLTableButton,
GLTableOption, GLTableOption,
GLImage,
//业务组件 //业务组件
GLProvince, GLProvince,
GLBcTest, GLBcTest,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
*/ */
import Vue from 'vue' import Vue from 'vue'
import { Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem,DropdownMenu, Dialog,MessageBox, Tabs, TabPane,Checkbox,CheckboxGroup} from 'element-ui' import { Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem,DropdownMenu, Dialog,MessageBox, Tabs, TabPane,Checkbox,CheckboxGroup,Image} from 'element-ui'
// import 'element-ui/lib/theme-chalk/index.css' //todo 按需引入插件样式 // import 'element-ui/lib/theme-chalk/index.css' //todo 按需引入插件样式
import 'element-ui/lib/theme-chalk/table.css' import 'element-ui/lib/theme-chalk/table.css'
import 'element-ui/lib/theme-chalk/table-column.css' import 'element-ui/lib/theme-chalk/table-column.css'
...@@ -30,6 +30,7 @@ import 'element-ui/lib/theme-chalk/tabs.css' ...@@ -30,6 +30,7 @@ import 'element-ui/lib/theme-chalk/tabs.css'
import 'element-ui/lib/theme-chalk/tab-pane.css' import 'element-ui/lib/theme-chalk/tab-pane.css'
import 'element-ui/lib/theme-chalk/checkbox.css' import 'element-ui/lib/theme-chalk/checkbox.css'
import 'element-ui/lib/theme-chalk/checkbox-group.css' import 'element-ui/lib/theme-chalk/checkbox-group.css'
import 'element-ui/lib/theme-chalk/image.css'
// 解决 ElTable 自动宽度高度导致的「ResizeObserver loop limit exceeded」问题 // 解决 ElTable 自动宽度高度导致的「ResizeObserver loop limit exceeded」问题
...@@ -64,9 +65,10 @@ Vue.use(Tabs) ...@@ -64,9 +65,10 @@ Vue.use(Tabs)
Vue.use(TabPane) Vue.use(TabPane)
Vue.use(Checkbox) Vue.use(Checkbox)
Vue.use(CheckboxGroup) Vue.use(CheckboxGroup)
Vue.use(Image)
// Vue.use(MessageBox) // Vue.use(MessageBox)
Vue.prototype.$confirm = MessageBox.confirm Vue.prototype.$confirm = MessageBox.confirm
//打包后的组件dist 测试组件可能需要的 //打包后的组件dist 测试组件可能需要的
export { Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem,DropdownMenu,Dialog,MessageBox, Tabs, TabPane,Checkbox,CheckboxGroup } export { Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem,DropdownMenu,Dialog,MessageBox, Tabs, TabPane,Checkbox,CheckboxGroup,Image }
...@@ -799,3 +799,23 @@ $lightColorDisabled: $color-primary-light04; ...@@ -799,3 +799,23 @@ $lightColorDisabled: $color-primary-light04;
} }
} }
} }
// 图片放大预览样式
.el-image-viewer__wrapper{
.el-image-viewer__btn{
background-color:#333;
}
.el-image-viewer__close{
border-radius:0;
}
.el-image-viewer__actions{
border-radius:0;
}
.el-icon-zoom-out,.el-icon-zoom-in,.el-icon-full-screen,.el-icon-c-scale-to-original,.el-icon-refresh-left,.el-icon-refresh-right{
&:hover{
color:#fff;
}
padding: 2px;
border:1px solid #666;
color: #666;
}
}
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!