1、引入js
注意:引入顺序,先加载vue,在加载elementui 否则elementui无效果
1.1 引入element_ui样式
地址:https://unpkg.com/element-ui/lib/theme-chalk/index.css
1.2 引入vue.js
地址:https://cn.vuejs.org/v2/guide/installation.html
1.3 引入element_ui.js
地址:https://unpkg.com/element-ui/lib/index.js
1.4 下载element_ui的字体文件
注意:如果不下载,有的图标不会显示
地址:https://unpkg.com/element-ui/lib/theme-chalk/fonts/
位置放到fonts/下
1.5 遇到问题:Failed to decode downloaded font
原因:文件受损,无法解析
验证文件地址:https://www.fontsquirrel.com/tools/webfont-generator
解决方案:重新下载
2、使用
<%@ page contentType="text/html;charset=UTF-8" language="java" %><html><head> <title>element-图片预览-demo</title> <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script> <script src="https://unpkg.com/element-ui/lib/index.js"></script></head><body><div id="app"> <div class="demo-image__preview"> <el-image style="width: 100px; height: 100px" :src="url" :preview-src-list="srcList"> </el-image> </div></div><script> var Main = { data() { return { 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' ] } } } var Ctor = Vue.extend(Main) new Ctor().$mount('#app')</script></body></html>
3、效果
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/117247.html