@@ -12,14 +12,12 @@ npm run build
1212
1313see samples/browser/searchMetaTables.html and test request result
1414
15- ### 浏览器端安装
16-
17- https://github.com/datafe/aliyun-dataworks-sdk-js/blob/master/browser.md
18-
1915## 使用方法及代码示例
2016
2117### Window Object Using
2218
19+ 浏览器端安装,请查看此[ 链接] ( https://github.com/datafe/aliyun-dataworks-sdk-js/blob/master/browser.md )
20+
2321import dist/aliyun-dataworks-sdk.js into html
2422
2523``` javascript
@@ -45,7 +43,7 @@ dataworks?.searchMetaTables?.({
4543
4644### Module Import
4745
48- 此import方法在vite脚手架上会失败,建议直接透过<script>标签载入dist/aliyun-dataworks-sdk.min.js代码引用
46+ #### Common JS
4947
5048` ` ` javascript
5149import ALY from ' aliyun-dataworks-sdk-js' ;
@@ -67,3 +65,33 @@ dataworks?.searchMetaTables?.({
6765 console ? .log ? .(err, res);
6866});
6967` ` `
68+
69+ #### Vite
70+
71+ 将aliyun-dataworks-sdk.min.js放至publicDir,然后在html透过script标签载入dist/aliyun-dataworks-sdk.min.js代码引用
72+
73+ ` ` ` html
74+ < script type= " text/javascript" src= " /aliyun-dataworks-sdk.min.js" >< / script>
75+ ` ` `
76+
77+ ` ` ` javascript
78+
79+ if (! globalThis .ALY ) return ;
80+ let dataworks = new globalThis.ALY.DATAWORKS ({
81+ // see https://ram.console.aliyun.com/manage/ak
82+ accessKeyId: " Your Access Key" ,
83+ secretAccessKey: " Your Access Secret" ,
84+ endpoint: ' http://dataworks.cn-shanghai.aliyuncs.com' ,
85+ apiVersion: ' 2020-05-18'
86+ });
87+
88+ // example https://next.api.aliyun.com/api/dataworks-public/2020-05-18/SearchMetaTables
89+ dataworks? .searchMetaTables ? .({
90+ AppGuid: ' odps.YOUR_MC_PROJECT' ,
91+ Keyword: ' test' ,
92+ DataSourceType: ' ODPS' , // support ODPS, emr
93+ }, (err , res ) => {
94+ console ? .log ? .(err, res);
95+ });
96+
97+ ` ` `
0 commit comments