提交 7d50c532 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

feat(App.uvue): 补充 mixin 示例

上级 a0b3f9d2
......@@ -3,6 +3,16 @@
let firstBackTime = 0
export default {
// #ifndef APP-ANDROID
mixins: [
{
data() {
return {
appMixinDataMsg: 'App.uvue mixin data msg'
}
}
}],
// #endif
onLaunch: function (options) {
console.log(options)
// 自动化测试
......@@ -64,28 +74,39 @@
return false
}
return true
},
// #ifndef APP-ANDROID
checkAppMixin() : boolean {
if(this.globalMixinDataMsg1 != '通过 defineMixin 定义全局 mixin data') {
return false
}
if(this.appMixinDataMsg != 'App.uvue mixin data msg') {
return false
}
return true
}
// #endif
}
}
</script>
<style>
@import './styles/common.css';
@import './styles/common.css';
.list-item-text {
line-height: 36px;
}
.list-item-text {
line-height: 36px;
}
.split-title {
margin: 20px 0 5px;
padding: 5px 0;
border-bottom: 1px solid #dfdfdf;
}
.split-title {
margin: 20px 0 5px;
padding: 5px 0;
border-bottom: 1px solid #dfdfdf;
}
.btn-view {
margin: 10px 0;
padding: 10px;
border: 1px solid #dfdfdf;
border-radius: 3px;
}
</style>
.btn-view {
margin: 10px 0;
padding: 10px;
border: 1px solid #dfdfdf;
border-radius: 3px;
}
</style>
\ No newline at end of file
......@@ -23,7 +23,6 @@ export function createApp() {
app.provide('globalProvideMsg', 'global provide message')
// #ifdef APP-ANDROID || APP-IOS
const globalChildMixin = defineMixin({
components: { GlobalChildMixinComp1, MixinComp: MixinCompForGlobalChildMixin },
props: {
......@@ -263,7 +262,6 @@ export function createApp() {
}
})
app.mixin(globalMixin)
// #endif
app.use(plugin1)
app.use(plugin2)
......
......@@ -5,5 +5,8 @@ describe("app launch & show options", () => {
const page = await program.reLaunch(HOME_PATH)
await page.waitFor(1000)
expect(await page.callMethod("checkLaunchPath")).toBe(true)
if (!process.env.uniTestPlatformInfo.startsWith('android')) {
expect(await page.callMethod("checkAppMixin")).toBe(true)
}
})
})
......@@ -1195,7 +1195,14 @@ export default {
checkLaunchPath() : boolean {
const app = getApp()
return app.checkLaunchPath()
},
// #ifndef APP-ANDROID
// 自动化测试
checkAppMixin() : boolean {
const app = getApp()
return app.checkAppMixin()
}
// #endif
}
}
</script>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册