【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)
相关推荐
恋猫de小郭41 分钟前
看懂大模型架构术语,帮助你理解目前常见的大模型开源架构
前端·人工智能·ai编程
yma161 小时前
通过提示词实现GitHub Pages 和 Nginx 双部署竟然这么简单?
前端
前端 贾公子1 小时前
第09章:上下文与记忆 (2)
java·服务器·前端
可乐鸡翅yeah_1 小时前
第三方接口对接 M3U8 流媒体排坑实战,解决外部服务商流兼容难题
前端·javascript·python·django·html·m3u8·m3u8在线
GoppViper1 小时前
RDF资源描述框架深度解析:语义Web的数据基石与实战逻辑
前端·数据库
郑州光合科技余经理1 小时前
本地生活服务系统:模块边界与结算字段怎么拆
java·开发语言·前端·后端·系统架构·uni-app·php
IT_陈寒1 小时前
Vue的嵌套组件竟然吃掉了我的事件?
前端·人工智能·后端
默_笙1 小时前
🏠 「LLM Notes」:我用 Next.js + Redis 给自己造了个笔记博客
前端·javascript
风骏时光牛马1 小时前
AI开发平台异常指标实时监控告警
前端