File tree Expand file tree Collapse file tree 4 files changed +48
-4
lines changed
Expand file tree Collapse file tree 4 files changed +48
-4
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " hello-vue" ,
33 "version" : " 0.1.0" ,
4- "private" : true ,
4+ "private" : false ,
5+ "files" : [
6+ " dist" ,
7+ " package.json"
8+ ],
9+ "unpkg" :" dist/ng-bi.min.js" ,
510 "scripts" : {
611 "serve" : " vue-cli-service serve" ,
712 "build" : " vue-cli-service build" ,
813 "lint" : " vue-cli-service lint" ,
9- "wc" : " vue-cli-service build --target wc --name ng-bi './src/views/web-component/ components/*.vue'"
14+ "wc" : " vue-cli-service build --target wc --name ng-bi './src/components/*.vue'"
1015 },
1116 "dependencies" : {
1217 "core-js" : " ^3.6.4" ,
Original file line number Diff line number Diff line change 88export default {
99 name: ' HelloWorld' ,
1010 props: {
11- msg: String
11+ msg: {
12+ type: String ,
13+ default: ' Hello World!'
14+ }
1215 },
1316 data () {
1417 return {}
Original file line number Diff line number Diff line change 11<template >
22 <div >
3- <HelloWorld msg = " Welcome to Your Vue.js App " />
3+ <HelloWorld />
44 <MyVueName />
55 <MyRating />
66 </div >
Original file line number Diff line number Diff line change 1+ <!--
2+ * @Description :
3+ * @Date : 2022-01-17 00:09:08 +0800
4+ * @Author : JackChou
5+ * @LastEditTime: 2022-01-17 00:22:54 +0800
6+ * @LastEditors : JackChou
7+ -->
8+ <!DOCTYPE html>
9+ < html lang ="en ">
10+
11+ < head >
12+ < meta charset ="UTF-8 ">
13+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
14+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
15+ < title > Document</ title >
16+ < script src ="https://unpkg.com/vue "> </ script >
17+ < script type ="module " src ="https://unpkg.com/web-components-jack "> </ script >
18+ < script src ="/dist/ng-bi.min.js "> </ script >
19+ < script >
20+ // NOTE 告诉 vue 哪些时自定义元素
21+ Vue . config . ignoredElements = [ 'my-rating' , 'my-name' ]
22+ document . addEventListener ( "DOMContentLoaded" , ( ) => {
23+ const myRating = document . querySelector ( 'ng-bi-my-rating' )
24+ myRating . buttonOptions = { size : 'mini' , round : true }
25+ } )
26+ </ script >
27+ </ head >
28+
29+ < body >
30+ < ng-bi-hello-world msg ="从 vue component 到 web-component "> </ ng-bi-hello-world >
31+ < ng-bi-hello-world > </ ng-bi-hello-world >
32+ < ng-bi-my-name > </ ng-bi-my-name >
33+ < ng-bi-my-rating > </ ng-bi-my-rating >
34+ </ body >
35+
36+ </ html >
You can’t perform that action at this time.
0 commit comments