# my-site **Repository Path**: adils/my-site ## Basic Information - **Project Name**: my-site - **Description**: vue2学习练手项目 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-12-19 - **Last Updated**: 2022-02-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # my-site ## Project setup ``` npm install ``` ### Compiles and hot-reloads for development ``` npm run serve ``` ### Compiles and minifies for production ``` npm run build ``` ### Customize configuration See [Configuration Reference](https://cli.vuejs.org/config/). ```js //测试纯dom操作 import styles from "./styles/message.module.less"; const div = document.createElement("div"); div.innerHTML = "abcd"; div.className = styles.message; document.body.append(div); //得到一个组件渲染的DOM function getComponentRootDom(comp, props) { const vm = new Vue({ render: (h) => h(comp, { props, }), }); vm.$mount(); return vm.$el; } import Icon from "./components/Icon"; const dom = getComponentRootDom(Icon, { type: "home", }); console.log(dom); //向实例注入成员 Vue.prototype.$say = function () { console.log("hello!~"); }; ```