【vue演练场安装 element-plus框架】

在线vue 演练场地址:

https://play.vuejs.org/

配置element-plus js map :

import Map:

javascript 复制代码
{

  "imports": {

    "vue": "https://cdn.jsdelivr.net/npm/@vue/runtime-dom@3.4.0-beta.1/dist/runtime-dom.esm-browser.prod.js",

    "vue/server-renderer": "https://cdn.jsdelivr.net/npm/@vue/server-renderer@3.4.0-beta.1/dist/server-renderer.esm-browser.js",

    "element-plus": "https://unpkg.com/element-plus@2.4.3/dist/index.full.mjs"

  },

  "scopes": {}

}

css导入 用 <style> 标签@import url解决:

App.vue:

html 复制代码
<script setup>
import { defineComponent, ref, getCurrentInstance } from 'vue'
import Comp from './Comp.vue'
import ElementPlus from 'element-plus'

getCurrentInstance().appContext.app.use(ElementPlus)

const msg = ref('Hello World!')
const value1 = ref('')
</script>

<template>
  <div>
    <el-button>{{ msg }}</el-button>
    <div class="block">
      <el-date-picker v-model="value1" type="datetime" placeholder="Select date and time"></el-date-picker>
    </div>
    <el-dropdown>
      <span class="el-dropdown-link">
        Dropdown List
        <el-icon class="el-icon--right">
          <arrow-down />
        </el-icon>
      </span>
      <template #dropdown>
        <el-dropdown-menu>
          <el-dropdown-item>Action 1</el-dropdown-item>
          <el-dropdown-item>Action 2</el-dropdown-item>
          <el-dropdown-item>Action 3</el-dropdown-item>
          <el-dropdown-item disabled>Action 4</el-dropdown-item>
          <el-dropdown-item divided>Action 5</el-dropdown-item>
        </el-dropdown-menu>
      </template>
    </el-dropdown>
    <Comp></Comp>
  </div>
</template>

<style >
   @import url("https://unpkg.com/element-plus@2.4.3/dist/index.css")
</style>

app.vue中 全局install element-plus组件:

javascript 复制代码
import ElementPlus from 'element-plus'
 
getCurrentInstance().appContext.app.use(ElementPlus)
相关推荐
weixin_471383035 分钟前
Taro-02-页面路由
前端·taro
星栈独行11 分钟前
Makepad 应用如何读文件、调接口、保存数据
前端·程序人生·ui·rust·github
IT_陈寒1 小时前
Vite热更新失效?可能你在用Windows
前端·人工智能·后端
tedcloud1231 小时前
taste-skill部署教程:打造个性化AI推荐工作流
服务器·前端·人工智能·系统架构·edge
xinhuanjieyi2 小时前
html修复游戏种太阳错误
前端·游戏·html
林希_Rachel_傻希希2 小时前
学React治好了我的焦虑症,1小时速通React 前20分钟。
前端·javascript·面试
Cache技术分享2 小时前
435. Java 日期时间 API - Clock 灵活获取当前时间
前端·后端
独泪了无痕4 小时前
Vue3中防御XSS攻击的“特效药”-DOMPurify
前端·vue.js·安全
小小19924 小时前
idea 配置less转化为css
前端·css·less
hhb_6184 小时前
Less嵌套避坑:优先级冲突实战解析
前端·css·less