【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)
相关推荐
谭光志1 天前
Vibe Coding 时代,程序员该何去何从
前端·后端·ai编程
仿生狮子1 天前
别再说“全栈”了,AI 时代团队只认这 5 种人
前端·人工智能·后端
kyriewen1 天前
AI 写的 React 组件,合并前必查的 6 个坏味道——每个都有代码对比
前端·javascript·react.js
Highcharts.js1 天前
软件开发公司为什么选择 Highcharts?
前端·前端框架·echarts·数据可视化·技术选型·highcharts·图表工具
阿祖zu1 天前
企业 AI 转型之痛,个人提效十倍不止,组织效率仍止步不前?
前端·aigc·agent
摇滚侠1 天前
SpringBoot3+Vue3 全套视频教程 45-51
前端·javascript·vue.js
酸梅果茶1 天前
【6】lightning_lm项目-LIO 前端 -点云预处理模块
前端·slam
Hilaku1 天前
前端大裁员背后的恐慌:我们还剩什么底牌?
前端·javascript·程序员
咖啡无伴侣1 天前
unplugin-auto-import 使用详解+面试高频考点
前端·架构
搬砖记录员1 天前
录屏文件打不开?H.265兼容性踩坑与4种实战方案
前端